View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default is number between to other numbers.

Dim zip as String, z1 as Long, cell as Range
zip = "12345"
z1 = clng(Left(zip,4))
for each cell in Range(A2:A500")
if z1 = cell and z1 <= cell.offset(0,1) then
msgbox "City is " & cell.offset(0,2)
exit for
end if
Next

--
regards,
Tom Ogilvy


"hans" wrote:

In collumn a i have the zipcode a city starts with (4 numbers)
In collumn b i have the ziptcode a city ends with (4 numbers)
In collumn c i have the citynames etc etc
Is there a way to check is a zipcode entert belong to a city?
there are zipcodes not used?

Greetings Hans