Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to find next up matching cell? | Excel Worksheet Functions | |||
Find matching values | Excel Worksheet Functions | |||
Find matching values in two different columns | Excel Worksheet Functions | |||
Macro to find matching date and copy values to another sheet | Excel Discussion (Misc queries) | |||
find a cell matching separate column and row values | Excel Worksheet Functions |