Compare dates in two worksheets

L

laavista

I'm using Excel 2003, and I really need help.

I am comparing two dates; 1 date is in worksheet1 and the other date is in
worksheet2. Both date columns are formatted as mm/dd/yy

I pick up the date in worksheet1 and store it in varaible "OrigOrderDate"
(string variable)

I use the following to locate the correct ID in worksheet2, the row in which
the date I want to compare is located. The Row is stored in variable
FoundRow.
Set C = .Find(profileid, LookIn:=xlValues, LookAt:=xlWhole)
The date I want to compare is in column 3

It finds the ID and the FoundRow is correct

I use the following to store the date in worksheet2 in the string variable
OrderDateInOrders.
OrderDateInOrders = Cells(FoundRow, 3)

When I step through the procedure, after I PASS the above statement and I
check what's stored in the variables, the OrderDateInOrders did not pick up
the date in cells(FoundRow,3).

After the procedure is PASSED the values are:
OrderDateInOrders = "8/6/2009"
Cells(FoundRow,3) = 8/12/2009


I tried changing the variables to a date format, then this failed:
Set C = .Find(profileid, LookIn:=xlValues, LookAt:=xlWhole)

Your help would be GREATLY appreciated!
 
J

Jacob Skaria

Are you sure you are referring to the correct sheet

OrderDateInOrders = Worksheets("Sheet2").Cells(FoundRow, 3)


If this post helps click Yes
 
L

laavista

THANK YOU so much. I can't believe I did not explictly refer to the
worksheet. This work.

THANKS!!!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top