LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default code to find dates

Greetings,
TIA for any help
I have a worksheet range: 01/01/1997, 01/02/1997, etc.
This is formatted as "mmm-yy" to give Jan-97, Feb-97, etc.

The following code from Reed Jacobson's 'Step by Step'
book fails to find the cell showing "May-97" as intended:

Dim myFind As Range
Set myFind = Rows(1).Find(What:="5/1/1997", _
After:=Range("A1"), _
LookIn:=xlFormulas _
, LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
Range("C1", myFind.Offset(, -1)).EntireColumn.Hidden = True

Changing the "5/1/1997" to "01/05/1997" etc. has no effect
(myFind =Nothing, still) Changing to "May-97" and changing
argument xlformulas to xlvalues works OK but is inflexible
and puts me at the mercy of the cell formatting. What is
the secret with dates?
David


 
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
compare 2 tables of dates to find the preceding dates Babi Excel Worksheet Functions 3 October 28th 08 05:52 AM
Code to find code D. Excel Discussion (Misc queries) 2 August 12th 07 06:16 PM
what is the code for calender dates? gabe Excel Discussion (Misc queries) 1 July 4th 06 12:09 PM
How do I find the earliest dates in a range of dates? JJ Excel Worksheet Functions 3 May 16th 06 09:36 AM
to find number of days between 2 dates using vba code in excel sjayar Excel Discussion (Misc queries) 3 November 3rd 05 06:24 AM


All times are GMT +1. The time now is 05:45 PM.

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"