Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Find row with matching cell and retrieve values (VBA)

Using VBA, say I am in Sheet1 worksheet. In sheet2 is four columns.
I have a value stored in a variable. I want to find the row that has
the matching value in Sheet2 Column D. Once it finds the row that
matches, copy the values out of that row's A, B, and C cells into
variables. Any help on this would be much appreciated.

Thanks.

JR
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Find row with matching cell and retrieve values (VBA)

Dim vVal, vValA, vValB, vValC
vVal = worksheets("Sheet1").Range("A1").Value
res = Application.Match(vVal,Worksheets("Sheet2").Range( "D1:D500"),0)
if not iserror(res) then
With Worksheets("Sheet2")
vValA = .range("A1:A500)(res).Value
vValB = .range("B1:B500)(res).Value
vValC = .range("C1:C500)(res).Value
end if

--
Regards,
Tom Ogilvy

"John" wrote in message
om...
Using VBA, say I am in Sheet1 worksheet. In sheet2 is four columns.
I have a value stored in a variable. I want to find the row that has
the matching value in Sheet2 Column D. Once it finds the row that
matches, copy the values out of that row's A, B, and C cells into
variables. Any help on this would be much appreciated.

Thanks.

JR



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
How to find next up matching cell? DevourU Excel Worksheet Functions 0 March 3rd 10 05:20 PM
Find matching values chris Excel Worksheet Functions 2 December 4th 08 04:57 PM
Find matching values in two different columns lmarstin Excel Worksheet Functions 5 July 14th 08 07:51 PM
Macro to find matching date and copy values to another sheet Tiger Excel Discussion (Misc queries) 3 August 13th 07 01:45 PM
find a cell matching separate column and row values LQEngineer Excel Worksheet Functions 2 July 26th 06 07:10 AM


All times are GMT +1. The time now is 11:38 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"