sn152
Member
Hi All,
I have a workbook where I have to validate the format of Column A. i.e., Column A should be in the below format:
1st four characters should be numbers and the next character should be "-" and then the rest should be text.
I have the below code. But it does not serve the purpose. Kindly help me here.
I have a workbook where I have to validate the format of Column A. i.e., Column A should be in the below format:
1st four characters should be numbers and the next character should be "-" and then the rest should be text.
I have the below code. But it does not serve the purpose. Kindly help me here.
Code:
Sub Validate()
Dim LastRow As Long
Dim m As Variant
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
m = Left(Range("A11"), 4)
If IsNumeric(m) Then
ActiveCell.Interior.ColorIndex = xlNone
Else
ActiveCell.Interior.ColorIndex = 3
End If
End Sub