Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default find TWO values in a worksheet

I have two worksheets. One called "OpenOrders" and one called
"Supplier". I need to determine if the supplier id in the Supplier
worksheet matches the id in the OpenOrders AND if the order dates in both
match. It seems so simple, but nothing I'm trying is working.

The following DOES find the ID, but I can't pick up the order date in the
ID's row so I can compare it with the order date in supplier. After I found
the ID, I tried picking up the date using:
OrdersOrderDate = Cells(FoundRow, 3) ', e.g., foundrow=2
This didn't work. I then tried the following (which also doesn't work)

Your help would be GREATLY appreciated!

Dim FoundRow As String
Dim C As Range
Dim D As Range

With Sheets("Supplier").Range("b1:f2000")
ID = Cells(FromRow, 2) ' get ID from supplier tab. THIS WORKS
SupplierOrderDate = Cells(FromRow, 3) 'THIS WORKS
With Sheets("OpenOrders").Range("b1:c2000")
Set C = .Find(ID, LookIn:=xlValues, LookAt:=xlWhole) 'THIS WORKS
If Not C Is Nothing Then 'THIS WORKS, C DOES CONTAIN THE ID#
FoundRow = C.Row ' get row where ID is found
x = FoundRow & ":" &
Rows(x).Select

With Sheets("OpenOrders").Range(x)
' === the following does not work. SupplierOrderDate not found.
' Variable shows "08/31/2009".
' ==== order date it should be matching to is "08/31/09".
' Both date columns are formatted the same
Set D = .Find(SupplierOrderDate, LookIn:=xlValues)
If Not D Is Nothing Then
OrdersOrderDate = Cells(FoundRow, 3)
End If
End With

End With



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default FOUND ANSWER--PLEASE IGNORE.

FOUND THE ANSWERS. PLEASE IGNORE.

Thanks.




"laavista" wrote:

I have two worksheets. One called "OpenOrders" and one called
"Supplier". I need to determine if the supplier id in the Supplier
worksheet matches the id in the OpenOrders AND if the order dates in both
match. It seems so simple, but nothing I'm trying is working.

The following DOES find the ID, but I can't pick up the order date in the
ID's row so I can compare it with the order date in supplier. After I found
the ID, I tried picking up the date using:
OrdersOrderDate = Cells(FoundRow, 3) ', e.g., foundrow=2
This didn't work. I then tried the following (which also doesn't work)

Your help would be GREATLY appreciated!

Dim FoundRow As String
Dim C As Range
Dim D As Range

With Sheets("Supplier").Range("b1:f2000")
ID = Cells(FromRow, 2) ' get ID from supplier tab. THIS WORKS
SupplierOrderDate = Cells(FromRow, 3) 'THIS WORKS
With Sheets("OpenOrders").Range("b1:c2000")
Set C = .Find(ID, LookIn:=xlValues, LookAt:=xlWhole) 'THIS WORKS
If Not C Is Nothing Then 'THIS WORKS, C DOES CONTAIN THE ID#
FoundRow = C.Row ' get row where ID is found
x = FoundRow & ":" &
Rows(x).Select

With Sheets("OpenOrders").Range(x)
' === the following does not work. SupplierOrderDate not found.
' Variable shows "08/31/2009".
' ==== order date it should be matching to is "08/31/09".
' Both date columns are formatted the same
Set D = .Find(SupplierOrderDate, LookIn:=xlValues)
If Not D Is Nothing Then
OrdersOrderDate = Cells(FoundRow, 3)
End If
End With

End With



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default find TWO values in a worksheet

Finding dates is a bit tricky... check out this link at the bottom of the
page...

http://www.cpearson.com/excel/DateTimeVBA.htm
--
HTH...

Jim Thomlinson


"laavista" wrote:

I have two worksheets. One called "OpenOrders" and one called
"Supplier". I need to determine if the supplier id in the Supplier
worksheet matches the id in the OpenOrders AND if the order dates in both
match. It seems so simple, but nothing I'm trying is working.

The following DOES find the ID, but I can't pick up the order date in the
ID's row so I can compare it with the order date in supplier. After I found
the ID, I tried picking up the date using:
OrdersOrderDate = Cells(FoundRow, 3) ', e.g., foundrow=2
This didn't work. I then tried the following (which also doesn't work)

Your help would be GREATLY appreciated!

Dim FoundRow As String
Dim C As Range
Dim D As Range

With Sheets("Supplier").Range("b1:f2000")
ID = Cells(FromRow, 2) ' get ID from supplier tab. THIS WORKS
SupplierOrderDate = Cells(FromRow, 3) 'THIS WORKS
With Sheets("OpenOrders").Range("b1:c2000")
Set C = .Find(ID, LookIn:=xlValues, LookAt:=xlWhole) 'THIS WORKS
If Not C Is Nothing Then 'THIS WORKS, C DOES CONTAIN THE ID#
FoundRow = C.Row ' get row where ID is found
x = FoundRow & ":" &
Rows(x).Select

With Sheets("OpenOrders").Range(x)
' === the following does not work. SupplierOrderDate not found.
' Variable shows "08/31/2009".
' ==== order date it should be matching to is "08/31/09".
' Both date columns are formatted the same
Set D = .Find(SupplierOrderDate, LookIn:=xlValues)
If Not D Is Nothing Then
OrdersOrderDate = Cells(FoundRow, 3)
End If
End With

End With



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default find TWO values in a worksheet

This was really helpful! Thanks so much.



"Jim Thomlinson" wrote:

Finding dates is a bit tricky... check out this link at the bottom of the
page...

http://www.cpearson.com/excel/DateTimeVBA.htm
--
HTH...

Jim Thomlinson


"laavista" wrote:

I have two worksheets. One called "OpenOrders" and one called
"Supplier". I need to determine if the supplier id in the Supplier
worksheet matches the id in the OpenOrders AND if the order dates in both
match. It seems so simple, but nothing I'm trying is working.

The following DOES find the ID, but I can't pick up the order date in the
ID's row so I can compare it with the order date in supplier. After I found
the ID, I tried picking up the date using:
OrdersOrderDate = Cells(FoundRow, 3) ', e.g., foundrow=2
This didn't work. I then tried the following (which also doesn't work)

Your help would be GREATLY appreciated!

Dim FoundRow As String
Dim C As Range
Dim D As Range

With Sheets("Supplier").Range("b1:f2000")
ID = Cells(FromRow, 2) ' get ID from supplier tab. THIS WORKS
SupplierOrderDate = Cells(FromRow, 3) 'THIS WORKS
With Sheets("OpenOrders").Range("b1:c2000")
Set C = .Find(ID, LookIn:=xlValues, LookAt:=xlWhole) 'THIS WORKS
If Not C Is Nothing Then 'THIS WORKS, C DOES CONTAIN THE ID#
FoundRow = C.Row ' get row where ID is found
x = FoundRow & ":" &
Rows(x).Select

With Sheets("OpenOrders").Range(x)
' === the following does not work. SupplierOrderDate not found.
' Variable shows "08/31/2009".
' ==== order date it should be matching to is "08/31/09".
' Both date columns are formatted the same
Set D = .Find(SupplierOrderDate, LookIn:=xlValues)
If Not D Is Nothing Then
OrdersOrderDate = Cells(FoundRow, 3)
End If
End With

End With



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
Find values from one worksheet in other worksheets Modell Excel Programming 3 August 29th 07 04:48 PM
How to Find values in one worksheet and copy them to a new workshe Fleone Excel Programming 2 March 29th 07 08:54 PM
Find two values in worksheet to return one value Correna Excel Worksheet Functions 10 May 4th 06 10:22 PM
Find corresponding values on another worksheet Reader Excel Discussion (Misc queries) 1 April 28th 06 10:09 AM
How do I find and replace "values" (like #N/A) in a worksheet? hdc Excel Discussion (Misc queries) 3 June 12th 05 12:14 AM


All times are GMT +1. The time now is 04:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"