Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim StartString As String
- Dim DateValue As String
- Dim y As Integer
- Dim LastRow2 As Long
- With Sheets("DataSheet")
- LastRow2 = .Cells(.Rows.Count, "L").End(xlUp).Row 'find the last row on column L
- .Columns(13).Insert Shift:=xlToRight 'add a new column to the right of column L
- For i = 1 To LastRow2 'loop through rows
- If InStr(1, .Cells(i, "L"), ",") Then
- .Cells(i, "M").Value = Split(.Cells(i, "L"), ",")(1) 'split after comma
- StartString = .Cells(i, "L").Value
- DateValue = ""
- For y = 1 To Len(StartString) 'loop to remove unwanted characters
- Select Case Asc(Mid(StartString, y, 1))
- Case 47 To 57
- DateValue = DateValue & Mid(StartString, y, 1)
- End Select
- Next y
- .Cells(i, "M").Value = DateValue 'return the date
- .Cells(i, "M").NumberFormat = "dd/mm/yyyy" 'format it correctly
- End If
- Next i
- End With
Add Comment
Please, Sign In to add comment