I just started using vba and I was wondering if I can get some guidance here. I am trying to set the range a1:a50 to accept only numbers written like this: i.e. 111.111.111 or 231.432.212. I set this by using %%%.%%%.%%% as I read that % is defined as a number in VBA.
However, using this format %%%.%%%.%%% does not do the job. Can anyone guide me to fix this if it is possible? Must appreciated.
Dim cell As Range
Application.EnableEvents = False
For Each cell In Target
If Not Application.Intersect(cell, Range("a1:a50")) Is Nothing Then
If Not cell.Value = %%%.%%%.%%% Then
cell.Interior.Color = RGB(0, 0, 255)
Else
cell.Interior.Color = RGB(1000, 1000, 1000)
End If
End If
Next cell
Application.EnableEvents = True