Hello to all,
Column B contains many lines of numbers, as per the following example:
Line1 111222/145251
Line2 333115
Line3 777555/154154
Line4 888999/115116
Line5 110110
Line6 110115
Line7 620260/145521
So numbers are always 6 digits long, sometimes separated by "/". I need to pass all data to columd D, in sets of 6 digits. In the present case all need to obtain 11 lines of all sets of 6 digits, without the slash.
I wrote a small peace of code but my experience in VBA is too bad to tell and i'm obtaining blank cells on column D:
Sub parte()
Dim linha As Integer
Dim coluna As Integer
Dim linhad As Integer
Dim colunad As Integer
Dim texto As String
Dim temb As Boolean
linha = 2
coluna = 2
linhad = 2
colunad = 4
For i = 1 To 20
texto = Plan1.Cells(linha, coluna)
temb = InStr(texto, "/")
Select Case temb
Case temb = True
Plan1.Cells(linhad, colunad) = Mid(texto, 1, 6)
Plan1.Cells(linhad + 1, colunad) = Mid(texto, 8, 6)
linha = linha + 1
linhad = linhad + 2
Case temb = False
Plan1.Cells(linhad, colunad) = Plan1.Cells(linha, coluna)
linha = linha + 1
End Select
Next i
End Sub
Can someone please let me know what am i doing wrong? (besides writing an horrible code, i know that because i'm not a programmer)
Many thanks in advance for any kind help.
Octavio
Bookmarks