Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Problem with VBA "Find" operation

My code (which follows) will not find a matching date.

Partial code:

"With Worksheets(myProject).Columns("AC")
Set FindClose = .Find(myCloseDate, LookIn:=xlValues)"

"myCloseDate" is a date and looks like "3/31/05".

In column "AC" is a formula that returns a date. The formula is:

=EOMONTH(Q119,0)

"FindClose" always comes up equal to "nothing". But there is a matching
date in column "AC".

What am I doing wrong?

Thank you for your assistance.

Don
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Problem with VBA "Find" operation

Dave,

Thank you for responding.

I kept playing with the problem and found another solution. If you format
the date column to exactly match the "FindWhat" date, it works. The format,
in my case, needed to be m/d/yyyy rather than my usual choice of m/d/yy.

I'll keep your solution in mind.

Thanks again.

Don

"Dave D-C" wrote:

Don wrote:
My code (which follows) will not find a matching date.
Partial code:
"With Worksheets(myProject).Columns("AC")
Set FindClose = .Find(myCloseDate, LookIn:=xlValues)"
"myCloseDate" is a date and looks like "3/31/05".
In column "AC" is a formula that returns a date. The formula is:
=EOMONTH(Q119,0)
"FindClose" always comes up equal to "nothing". But there is a matching
date in column "AC".


I get the same result. What does work is using a string variable
in the FIND statement. Which doesn't match the help info.

Sub sub1()
Dim MyCloseDate As Date, FindClose As Range
Dim zString$
Range("A5") = "3/31/05"
MyCloseDate = "3/31/05"
With Worksheets("sheet1").Columns("A")
Set FindClose = .Find(MyCloseDate, LookIn:=xlValues)
If FindClose Is Nothing Then
MsgBox "1st: Nothing"
Else
MsgBox "1st: " & FindClose.Address
End If
zString = MyCloseDate
Set FindClose = .Find(zString, LookIn:=xlValues)
If FindClose Is Nothing Then
MsgBox "2nd: Nothing"
Else
MsgBox "2nd: " & FindClose.Address
End If
End With
End Sub

--------
Sorry about the newsfeeds promos


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
http://www.newsfeed.com The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----

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
"ignoring" hidden cells in a copy/paste operation gvm Excel Discussion (Misc queries) 2 March 22nd 07 10:38 PM
Odd error - "This operation requires merged cells..." Maury Markowitz New Users to Excel 3 September 14th 06 01:54 AM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
"Multiple-step operation generated errors" Michael Daly Excel Programming 2 December 22nd 03 09:30 AM


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

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"