VBABEGINER
Well-known Member
- Joined
- Jun 15, 2011
- Messages
- 1,284
- Office Version
- 365
- Platform
- Windows
I need help on this code..Need some modification in it..and addition of some more condition...
I really work hard to understand, but really I'm not that much, to insert any new condition..
I really work hard to understand, but really I'm not that much, to insert any new condition..
Code:
Dim R As Long, X As Long, Cnt As Long, Data As Variant
Data = Range("B3", Cells(Rows.Count, "B").End(xlUp)).Resize(, 2)
For R = 1 To UBound(Data)
Cnt = 0
Data(R, 2) = ""
For X = Len(Data(R, 1)) To 1 Step -1
If Cnt < 4 Then
If IsNumeric(Mid(Data(R, 1), X, 1)) Then
Cnt = Cnt + 1
Data(R, 2) = Mid(Data(R, 1), X, 1) & Data(R, 2)
End If
ElseIf Cnt = 4 Then
Data(R, 2) = Format(Data(R, 2), "@@/01/@@")
Data(R, 1) = Left(Data(R, 1), X)
Cnt = 5
ElseIf IsNumeric(Mid(Data(R, 1), X, 1)) Then
Data(R, 1) = Left(Data(R, 1), X)
Exit For
End If
Next
Next
Range("F3").Resize(UBound(Data)).NumberFormat = "mm/dd/yyyy"
Range("E3").Resize(UBound(Data), 2) = Data