Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using a range from different worksheet in VLOOKUP in VBA
I have been having trouble trying to put a range into the VLookup
function. My range/table is in another worksheet, called Critical Values, in the same workbook. How could I reference a range from a different workbook or a different worksheet? I would perfer to reference a different workbook if possible. Here is what I have: **CN is a range I already defined inside the worksheet itself. Do I need to define it again in the code? And if so, how? Sub() Dim Countdata As Double Dim V As Double Set CN As Range Countdata = WorksheetFunction.CountA(ActiveSheet.Range(Cells(1 , ColIndex), Cells(Row, ColIndex))) V = Worksheetfuncion.VLookup(Countdata, Worksheet("CriticalValues").Range("CN"), 2, True) End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
CAN VLOOKUP SEARCH AN ENTIRE WORKSHEET INSTEAD OF RANGE OF CELLS | Excel Worksheet Functions | |||
Can you get the range reference for each page in a worksheet print range? | Excel Programming | |||
Range Question / error 1004: method Range of object Worksheet has failed | Excel Programming | |||
copy range on every worksheet (diff names) to a master worksheet (to be created) | Excel Programming | |||
copy range on every worksheet (diff names) to a master worksheet (to be created) | Excel Programming |