FIND function driving me nuts
Dates and VBA are trouble.
I'd try this:
dim FoundCell as range
set foundcell = Cells.Find(What:=dateserial(2005,12,07), _
After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
if foundcell is nothing then
msgbox "failed"
else
foundcell.activate
end if
"Duncan A. McRae" wrote:
I've been trying to get a FIND working in Excel 2003 which I remember
working fine earlier, but for some reason this attempt has been an
effort in futility. Here's the code generated by recording a macro and
CTRL-F to find the text I'm looking for:
Cells.Find(What:="2005.12.07", After:=ActiveCell, LookIn:=xlValues,
_
LookAt:=xlPart, SearchOrder:=xlByColumns,
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Running that code immediately after generating it returns an error! So
does every attempt at using it. I cannot believe that I've discovered
a bug. It works fine from the UI, but dies in VBA.
HELP!
Thanks;
Duncan
--
Dave Peterson
|