I have a range of amounts in column "K" in Excel. I would like the macro to go cell by cell starting in row 9 and show an error message if the amount in the cell is not in format ####,##.
So for example, I would expect an error message to appear if the amount is "1234.56" but not if the amount entered is "9,34"
I have below code but somehow it does not work. What should I write differently?
Sub Macro1()
lastrowK = Sheet1.Range("K" & Rows.Count).End(xlUp).Row
Col = "K"
For i = 9 To lastrowK
If InStr(1, Cells(i, Col), ".", vbTextCompare) <> 0 Then
MsgBox "Please check amount in following Cell " & Worksheets("Sheet1").Cells(i, Col).Address & "Format should be ####,##"
End If
Next i
End Sub