Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Excel Time issue


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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Time Conversion issue Farias Excel Discussion (Misc queries) 6 August 1st 08 03:47 PM
Excel time conversion issue benny Excel Discussion (Misc queries) 4 October 11th 07 09:10 PM
Time issue with Day Format K1KKKA Excel Discussion (Misc queries) 1 June 6th 07 10:24 AM
Time on the X Axis Issue Dave Charts and Charting in Excel 4 March 3rd 06 05:34 PM
Run Time Issue Steph[_3_] Excel Programming 2 May 27th 04 08:07 PM


All times are GMT +1. The time now is 06:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"