search for date fields

  • Thread starter Thread starter Danny
  • Start date Start date
D

Danny

Hi,

I've been trying for a while, but I can't figure it out - how do you
search for a date cell from an array of dates - I can only search for string
values, although all the cells contain dates.
Did anyone have to do this before (no luck with search function) - any
hints?

Best regards
 
Hi Danny,

Perhaps something like:

For Each cell In rng
If IsDate(cell) Then
'do something
End If
Next cell
 
Hi Danny,

This code works for me. Have you tried the Find method?

Sub test()
Dim dt As Date
Dim rng As Range

dt = DateSerial(2003, 12, 2)

Set rng = Sheet1.UsedRange.Find(what:=dt)
If Not rng Is Nothing Then MsgBox rng.Address
Set rng = Nothing
End Sub

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 

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

Back
Top