How can I tabulate a mass file?

Asked

Viewed 90 times

0

Hello, I have a 64500-line file and 11 tabular columns. The original file came from the counter system, which is a system for printing paper. I already got the headlines out, but I’m having trouble with the tabulation. Does anyone know a tool or method that recognizes when the line is correct and when it is not?

exemplo

When I don’t need to delete two tabs and it goes back to normal. This error happens 7122 times in my file. The file has 1050 pages for printing and I also need to remove 6 lines each page. Can anyone help me? I thought about replacing the tabulation with commas to create a CSV but I couldn’t.

  • It’s a job for regular expressions. I think you can solve it without having to program any scripts, just using Notepad++. Study regex and use text replacement tool.

  • Favour Be more specific in the question, an example of what is considered correct and not. What would exclude two tabs? Would the cells be? Lines?

1 answer

0

You can use this code to fix tabs:

Sub FixTabs()

Dim i, j, lastRow As Long

lastRow = Range("A1").End(xlDown).Row 'Contagem total de linhas

j = 1
For i = 1 To lastRow
    Do While Range("C" & i).Value = "" 'Substitua "C" pela coluna correspondente C/P
        Range("C" & i, "D" & i).Delete Shift:=xlToLeft '*Ajustar colunas a serem excluídas
        j = j + 1 'iterador para sair do loop
        If j = lastRow Then
            i = j
            GoTo continue 'pular linhas de código
        End If
    Loop
continue:
Next i
End Sub

*Use F8 to perform step by step and check that the code eliminates the correct cells

Browser other questions tagged

You are not signed in. Login or sign up in order to post.