Advertisement
Combreal

logParser.vba

Dec 23rd, 2020
1,677
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub wrap()
  2. ' wrap log lines suchas "23/12/2020 14:06:22 Maxime Jolly - Casque  - Evole 40MS - 47 - 1 - mjolly - DSI-CDS - SAM"
  3.    Set f = Sheets("SAM")
  4.     Dim data() As Variant
  5.     Dim TotalRows As Long
  6.     Dim model As String
  7.    
  8.     TotalRows = f.Cells.SpecialCells(xlLastCell).Row + 1
  9.     TotalRows = f.Range("O" & TotalRows).End(xlUp).Row
  10.     ReDim Preserve data(1 To 8, 1 To TotalRows)
  11.     For i = 2 To TotalRows
  12.         model = f.Range("O" & i).Value
  13.         Dim WrdArray() As String
  14.         WrdArray() = Split(model, " - ")
  15.         data(1, i - 1) = WrdArray(0) 'date + adm
  16.        data(2, i - 1) = WrdArray(1) 'type
  17.        data(3, i - 1) = WrdArray(2) 'model
  18.        data(4, i - 1) = WrdArray(3) 'price
  19.        data(5, i - 1) = WrdArray(4) 'quantity
  20.        data(6, i - 1) = WrdArray(5) 'login
  21.        data(7, i - 1) = WrdArray(6) 'team
  22.        data(8, i - 1) = WrdArray(7) 'center
  23.    Next
  24.     For j = LBound(data) To TotalRows - 1
  25.        Debug.Print data(1, j) & " --> " & data(2, j) & " --> " & data(3, j) & " --> " & data(4, j) & " --> " & data(5, j) & " --> " & data(6, j) & " --> " & data(7, j) & " --> " & data(8, j)
  26.     Next j
  27. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement