Code:
Option Explicit
Sub Rawdata()
Dim data(10) As String
Dim cnt, start, i, end_a, r_macro_data As Integer
For cnt = 2 To ThisWorkbook.Sheets("raw data 1").Range("A1").End(xlDown).Row
i = 0
r_macro_data = ThisWorkbook.Sheets("Macro-data 1").Range("A1").End(xlDown).Row + 1
ThisWorkbook.Sheets("Macro-data 1").Cells(r_macro_data, 1) = ThisWorkbook.Sheets("Raw Data 1").Cells(cnt, 1).Value
start = 1
With ThisWorkbook.Sheets("Raw Data 1")
start = InStr(start, .Cells(cnt, 2).Value, ":") + 2
end_a = InStr(start, .Cells(cnt, 2).Value, Chr(10)) - 1
If end_a = -1 Then end_a = Len(ThisWorkbook.Sheets("Raw Data 1").Cells(cnt, 2).Value) + 1
If start = 2 Then start = end_a
data(i) = Mid(.Cells(cnt, 2).Value, start, end_a - start)
End With
ThisWorkbook.Sheets("Macro-data 1").Cells(r_macro_data, 2 + i) = data(i)
For i = 1 To 3
With ThisWorkbook.Sheets("Raw Data 1")
start = InStr(start, .Cells(cnt, 2).Value, ":")
start = InStr(start, .Cells(cnt, 2).Value, Chr(10)) + 1
end_a = InStr(start, .Cells(cnt, 2).Value, Chr(10))
If end_a = 0 Then end_a = Len(ThisWorkbook.Sheets("Raw Data 1").Cells(cnt, 2).Value) + 1
If start = 2 Then start = end_a
data(i) = Mid(.Cells(cnt, 2).Value, start, end_a - start)
End With
ThisWorkbook.Sheets("Macro-data 1").Cells(r_macro_data, 2 + i) = data(i)
Next i
With ThisWorkbook.Sheets("Raw Data 1")
start = InStr(start, .Cells(cnt, 2).Value, ":") + 2
end_a = InStr(start, .Cells(cnt, 2).Value, Chr(10)) - 1
If end_a = -1 Then end_a = Len(ThisWorkbook.Sheets("Raw Data 1").Cells(cnt, 2).Value) + 1
If start = 2 Then start = end_a
data(i) = Mid(.Cells(cnt, 2).Value, start, end_a - start)
End With
ThisWorkbook.Sheets("Macro-data 1").Cells(r_macro_data, 2 + i) = data(i)
ThisWorkbook.Sheets("Macro-data 1").Cells(r_macro_data, 7) = ThisWorkbook.Sheets("Raw Data 1").Cells(cnt, 3).Value
Next cnt
End Sub
Bookmarks