Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default VLookup a named range

On Aug 23, 12:55*pm, "Charlotte E." wrote:
I have a named range on a worksheet, called 'TableRange'.

Making a vlookup in a worksheet formula will be like this
=VLOOKUP(F17,TableRange,2,1)

How to do this in VBA???

D = Application.Vlookup(cVal,"TableRange",2,1)
...doesn't work :-(

TIA

CE

You don't need the ,1 parameter as it is the default. See the help
index
= Application.Vlookup(cVal,range("TableRange"),2)
or try
= Application.Vlookup(cVal,[TableRange],2)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 160
Default VLookup a named range

I have a named range on a worksheet, called 'TableRange'.

Making a vlookup in a worksheet formula will be like this
=VLOOKUP(F17,TableRange,2,1)

How to do this in VBA???

D = Application.Vlookup(cVal,"TableRange",2,1)
....doesn't work :-(

TIA

CE
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default VLookup a named range

Charlotte E. expressed precisely :
I have a named range on a worksheet, called 'TableRange'.

Making a vlookup in a worksheet formula will be like this
=VLOOKUP(F17,TableRange,2,1)

How to do this in VBA???

D = Application.Vlookup(cVal,"TableRange",2,1)
...doesn't work :-(

TIA

CE


D = Application.WorksheetFunction.VLookup(cVal, "TableRange",2)

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 160
Default VLookup a named range


None of them work???

The name refers to a range in another workbook:

TableRange ='D:\\Data\Spreadsheets\Tables\[Rates.XLS]Rates'!$A:$CV

I have no problem doing it in a worksheet cell as a normal formula, but
how to do it in VBA???


CE



Den 23.08.2011 19:53, Don Guillett skrev:
On Aug 23, 12:55 pm, "Charlotte wrote:
I have a named range on a worksheet, called 'TableRange'.

Making a vlookup in a worksheet formula will be like this
=VLOOKUP(F17,TableRange,2,1)

How to do this in VBA???

D = Application.Vlookup(cVal,"TableRange",2,1)
...doesn't work :-(

TIA

CE

You don't need the ,1 parameter as it is the default. See the help
index
= Application.Vlookup(cVal,range("TableRange"),2)
or try
= Application.Vlookup(cVal,[TableRange],2)

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default VLookup a named range

Charlotte E. formulated on Wednesday :
None of them work???

The name refers to a range in another workbook:

TableRange ='D:\\Data\Spreadsheets\Tables\[Rates.XLS]Rates'!$A:$CV

I have no problem doing it in a worksheet cell as a normal formula, but how
to do it in VBA???


CE



Den 23.08.2011 19:53, Don Guillett skrev:
On Aug 23, 12:55 pm, "Charlotte wrote:
I have a named range on a worksheet, called 'TableRange'.

Making a vlookup in a worksheet formula will be like this
=VLOOKUP(F17,TableRange,2,1)

How to do this in VBA???

D = Application.Vlookup(cVal,"TableRange",2,1)
...doesn't work :-(

TIA

CE

You don't need the ,1 parameter as it is the default. See the help
index
= Application.Vlookup(cVal,range("TableRange"),2)
or try
= Application.Vlookup(cVal,[TableRange],2)


Open the workbook and ref the range as follows:

Set TableRange = _
Workbooks("Rates.XLS").Sheets("Rates").Range("$A:$ CV")

Otherwise, you'd have to use ADO to load the data into a recordset
without opening the file in Excel.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default VLookup a named range

Hey,

Simply use
range("range").value = "=VLOOKUP(F17,TableRange,2,1)"


On Aug 23, 10:55*pm, "Charlotte E." wrote:
I have a named range on a worksheet, called 'TableRange'.

Making a vlookup in a worksheet formula will be like this
=VLOOKUP(F17,TableRange,2,1)

How to do this in VBA???

D = Application.Vlookup(cVal,"TableRange",2,1)
...doesn't work :-(

TIA

CE


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
using a dynamic named range in a VLOOKUP Dave F Excel Discussion (Misc queries) 3 January 19th 07 08:38 PM
Vlookup in a named range tuph Excel Worksheet Functions 7 May 29th 06 02:23 AM
Vlookup in large named range KemS Excel Worksheet Functions 3 November 23rd 05 06:14 PM
Using named range in vlookup lasca Excel Programming 1 September 2nd 05 03:16 PM
Vlookup on named range kev Excel Programming 1 September 23rd 04 12:23 PM


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