Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default search for date fields

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default search for date fields

Hi Danny,

Perhaps something like:

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

--
Regards,
Norman

"Danny" wrote in message
...
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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default search for date fields

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]


Danny wrote:
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

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
Search for data and return multiple fields Tenshi Excel Discussion (Misc queries) 2 July 28th 08 10:09 AM
Excel SHOULD NOT AUTO-CHANGE formated text fields to DATE FIELDS! PSSSD Excel Worksheet Functions 2 August 8th 06 09:31 PM
Input one criteria to search in 5 fields Fanny Excel Discussion (Misc queries) 1 April 26th 06 04:11 AM
Date fields ir26121973 Excel Discussion (Misc queries) 2 April 9th 06 06:33 PM
HELP,how to show search result according to specifed criteria and selected fields Kortrijker Excel Programming 2 February 16th 04 02:31 PM


All times are GMT +1. The time now is 09:15 AM.

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

About Us

"It's about Microsoft Excel"