Sub export()
Dim last As Long, lrng As Range, r As Range
Dim arng As Range, l As Single, i As Single, v As String
last = Cells(Rows.Count, 2).End(xlUp).Row
Set lrng = Range("B2:B" & last)
For Each r In lrng
v = Replace(r.Value, " ", "")
l = Len(v) - 2
For i = 1 To l Step 3
Set arng = Cells(Rows.Count, 6).End(xlUp)(2)
arng.Value = r.Offset(0, -1).Value
arng.Offset(0, 1).Value = Mid(v, i, 3)
arng.Offset(0, 2).Value = Mid(v, i + 2, 1)
arng.Offset(0, 3).Value = Mid(v, i, 1)
Next
Next
Set arng = Nothing
Set lrng = Nothing
End Sub
Sub export()
Dim last As Long, lrng As Range, r As Range
Dim arng As Range, l As Single, i As Single, v As Variant
last = Cells(Rows.Count, 2).End(xlUp).Row
Set lrng = Range("B2:B" & last)
For Each r In lrng
v = Split(r.Value, " ")
For i = LBound(v) To UBound(v)
Set arng = Cells(Rows.Count, 6).End(xlUp)(2)
arng.Value = r.Offset(0, -1).Value
arng.Offset(0, 1).Value = v(i) 'Mid(v(i), i, 3)
arng.Offset(0, 2).Value = Right(v(i), 1) 'Mid(v(i), i + 2, 1)
arng.Offset(0, 3).Value = Left(v(i), InStr(v(i), "X") - 1) 'Mid(v(i), i, 1)
Next
Next
Set arng = Nothing
Set lrng = Nothing
End Sub
Sub export2()
Dim last As Long, lrng As Range, r As Range, m As Single
Dim arng As Range, l As Single, i As Single, v As Variant
last = Cells(Rows.Count, 2).End(xlUp).Row
Set lrng = Range("B2:B" & last)
For Each r In lrng
v = Split(Application.Trim(r.Value), " ")
For i = LBound(v) To UBound(v)
Set arng = Cells(Rows.Count, 6).End(xlUp)(2)
arng.Value = r.Offset(0, -1).Value
If Not Len(v(i)) = 3 Then
arng.Offset(0, 1).Value = ""
Else
arng.Offset(0, 1).Value = v(i)
End If
If Not IsNumeric(Right(v(i), 1)) Then
arng.Offset(0, 2).Value = Right(v(i), 1)
Else
arng.Offset(0, 2).Value = ""
End If
m = InStr(v(i), "X")
If Not m > 0 Then
If Not IsNumeric(v(i)) Then
arng.Offset(0, 3).Value = ""
Else
arng.Offset(0, 3).Value = v(i)
End If
Else
arng.Offset(0, 3).Value = Left(v(i), InStr(v(i), "X") - 1)
End If
Next
Next
Set arng = Nothing
Set lrng = Nothing
End Sub