Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Compare dates in two worksheets

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 a
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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Compare dates in two worksheets

Are you sure you are referring to the correct sheet

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


If this post helps click Yes
---------------
Jacob Skaria


"laavista" wrote:

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 a
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!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Compare dates in two worksheets

Try replacing in your statements
LookIn:=xlValues
by
LookIn:=xlFormulas

Mishell

"laavista" wrote in message
...
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 a
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!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Compare dates in two worksheets

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

THANKS!!!!!



"Jacob Skaria" wrote:

Are you sure you are referring to the correct sheet

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


If this post helps click Yes
---------------
Jacob Skaria


"laavista" wrote:

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 a
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!

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
compare dates Vic Excel Discussion (Misc queries) 3 May 1st 09 03:30 AM
compare 2 tables of dates to find the preceding dates Babi Excel Worksheet Functions 3 October 28th 08 05:52 AM
Compare Rows on different Worksheets and Output Difference's to other Worksheets. [email protected] Excel Programming 3 September 19th 07 04:48 PM
Compare Dates in vba Bythsx-Addagio[_2_] Excel Programming 4 May 24th 07 02:09 PM
how do I compare two dates? SlipperyPete Excel Worksheet Functions 3 April 19th 06 05:40 PM


All times are GMT +1. The time now is 01:09 AM.

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"