I am looking for a code that would split the cells of the last row after ":" as shown below:
Before
After
So far splitting data looks like this - but it only works for the first cell:
Sub test()
Dim ws As Worksheet
Set ws = Sheets("Sheet3")
Dim fullstring As String, colonposition As Integer, j As Integer, LastRow As Long, FirstRow As Long
Dim lRow As Long, lCol As Long
lRow = Cells(Rows.Count, 1).End(xlUp).Row
lCol = Cells(1, Columns.Count).End(xlToLeft).Column
For j = 1 To 3
fullstring = Cells(lRow, lCol).Value
colonposition = InStr(fullstring, ":")
Cells(lRow, j).Value = Left(fullstring, colonposition - 1)
lRow = lRow + 1
Cells(lRow, j).Value = Mid(fullstring, colonposition + 1)
Next
End Sub
I have found a similar problematic (with answer) here but can't manage to apply it ONLY to the last row
Any suggestions appreciated!
In case some people are interested in the answers to the discussion with @Ondrej, here are two codes, the first is static and the second is dynamic:
&
I prefer using Range method with for each statement, like following: