View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Lee-Z Lee-Z is offline
external usenet poster
 
Posts: 2
Default Problem with using variable in Find statement

try replacing

LookFor = Range("G1").Select

with

LookFor = Range("G1")


Lee-Z



"DOOGIE" wrote in message
...
I am writing a macro to locate the current date (in form mm/dd/yy) from a
column of dates in column A1. I am using a variable that is set to the
value
of cell G1 that uses the NOW function to return the current date. However,
the Find method does not seem to like a variable. Below is the code I am
currently using to locate the current date. When I run this I get an
error,
please help!

Dim LookFor
LookFor = Range("G1").Select
Range("A1").Select
Cells.Find(What:=LookFor, After:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:=_
False).Activate