PC Review


Reply
Thread Tools Rate Thread

Compare dates in two worksheets

 
 
laavista
Guest
Posts: n/a
 
      23rd Aug 2009
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!
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      23rd Aug 2009
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 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!

 
Reply With Quote
 
Mishell
Guest
Posts: n/a
 
      23rd Aug 2009
Try replacing in your statements
LookIn:=xlValues
by
LookIn:=xlFormulas

Mishell

"laavista" <(E-Mail Removed)> wrote in message
news:78B24DA3-DE4A-4D8B-9722-(E-Mail Removed)...
> 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!



 
Reply With Quote
 
laavista
Guest
Posts: n/a
 
      26th Aug 2009
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 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!

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to compare 2 worksheets... =?Utf-8?B?Qm9ubmll?= Microsoft Excel Misc 3 2nd Dec 2008 11:06 AM
compare 2 tables of dates to find the preceding dates Babi Microsoft Excel Worksheet Functions 3 28th Oct 2008 05:52 AM
Compare Rows on different Worksheets and Output Difference's to other Worksheets. dids72@gmail.com Microsoft Excel Programming 3 19th Sep 2007 04:48 PM
Compare Two Worksheets Jerry Microsoft Excel Programming 4 27th Feb 2005 02:35 PM
Compare Worksheets =?Utf-8?B?RGF2ZSBZ?= Microsoft Excel Worksheet Functions 0 10th May 2004 11:01 PM


Features
 

Advertising
 

Newsgroups
 


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