View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Excel Time issue

With Worksheets(2).Range("d1:d52")
Set c = .Find(cdbl(cdate(x)), LookIn:=xlValues)
Set d = .Find(cdbl(cdate(y)), LookIn:=xlValues)
End With

Might work.

--
Regards,
Tom Ogilvy

"John" wrote in message
...

Can anyone help please, I have a time line created with the code below
(where d3=0), so the time increments by 30 minutes and is displayed on the
worksheet formted as time

e.g.

0:30
1:00
1:30
2:00 etc etc

objExcel.Cells(4, 4).Formula = "=$D3+time(0,30,0)"

With objExcel
Set objRange1 = .Cells(4, 4)
Set objRange2 = .Range(.Cells(4, 4), .Cells(LastRow, 4))
End With

objRange1.AutoFill objRange2

then I retrieve start and end times from a database, I want to search the
sheet for the times, but because there is a mismatch between string and

time
i do not get any results with c and d both being set to nothing, how to i
resolve this to get a match ?? x would equal "09:30" for example


x = Trim(rs.Fields("Start Time"))
y = Trim(rs.Fields("End Time"))

With Worksheets(2).Range("d1:d52")
Set c = .Find(x, LookIn:=xlValues)
Set d = .Find(y, LookIn:=xlValues)
End With