VBABEGINER
Well-known Member
- Joined
- Jun 15, 2011
- Messages
- 1,284
- Office Version
- 365
- Platform
- Windows
Hi All,
This is my new query..
I have this code..
The above code separate "form number" and "date".
Now I'm facing one challenge in this..
i found 2 form number's which are actually not giving me correct output.
i.e. in Col B
when this separate, it giving me something wrong output..like this..
Output..which is wrong
Output should be..
Can any one able to give me something correction in code..
This is my new query..
I have this code..
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
The above code separate "form number" and "date".
Now I'm facing one challenge in this..
i found 2 form number's which are actually not giving me correct output.
i.e. in Col B
Code:
UTS-COVPG 7-03
IL 00 17 02/2013
when this separate, it giving me something wrong output..like this..
Output..which is wrong
Code:
Col E.........................Col F
UTS-COVPG 7-03.......12/3/1901
IL 00 17 02................20/01/13
Output should be..
Code:
Col E...............Col F..(MM/dd/yyyy)
UTS-COVPG.....07/01/2003
IL 00 17..........02/01/2013
Can any one able to give me something correction in code..