I have this code - and would like to have it applied to all the cells (G2:G66666) but that the code applies to its adjacent cell on the left.
Option Explicit
Sub test()
Dim a, i As Long, mytxt As String, temp As Long, msg As String, lastRow As Long
a = Range("a1").CurrentRegion.Value
For i = 1 To UBound(a, 1)
a(i, 1) = GetAsValue(a(i, 1))
a(i, 2) = GetAsValue(a(i, 2))
Next
mytxt = Range("f2").Value
temp = GetAsValue(mytxt)
If temp = 0 Then
Range("G2").Value = "Invalid postalcode"
Exit Sub
End If
For i = 1 To UBound(a, 1)
If (Not IsError(a(i, 1))) * (Not IsError(a(i, 2))) Then
If (temp >= a(i, 1)) * (temp <= a(i, 2)) Then
msg = a(i, 3)
Exit For
End If
End If
Next
Range("G2").Value = msg
End Sub
Solved by C. H. in 22 mins