'Maybe not all that elegant, but here's what I'd do... or something similar
' I just threw it togethor right now. I might work on it more in the future
' so that it's more efficient and robust.
'(You MUST first save the sheet- this will refresh Last Used Cell marker.)
Sub MoGryphs_Parser()
Dim i As Long
Dim x As Long
ReDim A(1 To 50) As String ' Increase if there's more than 50 _
space delim'd columns
Application.ScreenUpdating = False
' Go from row 1 to last USED row on the sheet.
For x = 1 To Cells.SpecialCells(xlCellTypeLastCell).Row
MoGryphs_Tokenizer Cells(x, 1).Value, A 'Call my custom function
i = 1 ' Re-Initialize
Do
If Len(A(i)) = 0 Then
Exit Do
End If
Cells(x, i + 1).Value = A(i)
i = i + 1
Loop
ReDim A(1 To 50) ' SEE NOTE ABOVE REGARDING ReDim A(1 To 50)
Next x
Application.ScreenUpdating = True
End Sub
Sub MoGryphs_Tokenizer(StrIn As String, StrOut() As String)
Dim i As Long
Dim idx As Integer
Dim LastSpace As Long
LastSpace = 0
idx = 0
If Len(StrIn) = 0 Then Exit Sub
For i = 1 To Len(StrIn)
If Mid(StrIn, i, 1) = " " Then
idx = idx + 1
If LastSpace > 0 Then
StrOut(idx) = Mid(StrIn, LastSpace + 1, i - LastSpace - 1)
Else
StrOut(idx) = Left(StrIn, i - 1 + 1)
End If
LastSpace = i
End If
Next i
idx = idx + 1
StrOut(idx) = Mid(StrIn, LastSpace + 1)
End Sub
I haven't taken into account Multiple spaces next to each other- in that case my Tokenizer routine would fail. You can modify how you want- I"m just too tired to fool-proof it all the way.
Good luck, and Keep Coding!