Application.Match with Times

P

Pat

I've been at this problem for a while now, and could not find any guidance
in previous posts.

I have a range 6 X 10 of times that coorespond to a schedule.
Start Break MealStart MealStop Break End
10:30 AM 12:00 PM 2:30 PM 3:30 PM 5:00 PM 7:00 PM

I then have a single row of times from midnight to 11:45 PM, in incriments
of 15 minutes.
12:00 AM 12:15 AM 12:30 AM 12:45 AM 1:00 AM etc

I am writing a macro that will iterate cell by cell through the schedule
times and return the cooresponding column number matching the time in the
single row (range named as "times").

Dim rng as Range
Dim TimeToFind as Double
Dim res as Variant
Dim CurRow, CurCol as Integer

CurCol = 1
CurRow = 1
Set rng = Range("times")
TimeToFind = CDbl(Cells(CurRow, CurCol))
res = Application.Match(TimeToFind, rng, 0)

Certain times are not being found, despite that they are clearly there! It
has no trouble finding 10:30 AM (serial: 0.4375), or 12:00 PM (serial: 0.5).
It pukes on 2:30 PM.

Can anyone shed some light on this or point me in the right direction?
Thanks for your assistance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top