Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
CAN VLOOKUP SEARCH AN ENTIRE WORKSHEET INSTEAD OF RANGE OF CELLS BROCK8292 Excel Worksheet Functions 4 April 3rd 23 07:42 PM
Can you get the range reference for each page in a worksheet print range? Crosby Excel Programming 3 April 12th 05 06:06 PM
Range Question / error 1004: method Range of object Worksheet has failed Paul Excel Programming 3 April 7th 05 02:56 PM
copy range on every worksheet (diff names) to a master worksheet (to be created) Bernie[_2_] Excel Programming 2 September 22nd 04 03:30 PM
copy range on every worksheet (diff names) to a master worksheet (to be created) Bernie[_3_] Excel Programming 0 September 22nd 04 03:26 PM


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