Please find customised code for you.
Hope this will help you.
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").Range("A1").End(xlDown).Row r_macro_data = ThisWorkbook.Sheets("Macro-data").Range("A1").End(xlDown).Row + 1 ThisWorkbook.Sheets("Macro-data").Cells(r_macro_data, 1) = ThisWorkbook.Sheets("Raw Data").Cells(cnt, 1).Value start = 1 For i = 1 To 5 With ThisWorkbook.Sheets("Raw Data") 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").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").Cells(r_macro_data, 1 + i) = data(i) Next i ThisWorkbook.Sheets("Macro-data").Cells(r_macro_data, 7) = ThisWorkbook.Sheets("Raw Data").Cells(cnt, 3).Value Next cnt End Sub Sub Rawdata1() 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 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 For i = 1 To 3 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, 1 + i) = data(i) Next i Next cnt End Sub




Reply With Quote
Bookmarks