LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Vlookup and named ranges

Hi. I have a probelm with a particular part of some code that, despite all my
efforts, will not run! This snippet of code is designed to define a range
based on named columns . i.e. a range of columns, that will be passed onto a
vlookup command

Dim lookup_range As Range
With Worksheets("MyWorksheet")
start_row = .Range("start_row_column").Column
end_row = .Range("end_row_colummn").Column

Set lookup_range = .Range(.Columns(start_row), .Columns(end_row)).Address
(ReferenceStyle:=xlA1, ColumnAbsolute:=False)

End With

If lookup_range is defined as a variant it will return something similar to
"$A:$D", which can then be incorporated into a vlookup, however if it is
defined as a range then it fails to assign.

I have also tired writing the code so that it will return a vlookup fucntion
with exactly the same variables as if I were to simply add it to the
worksheet, and I have also used used code where I explicitly define the range
and not use a variable and it all works!

My probelm lies in:
1. Sucessffully asigning lookup_range as a Range
2. then getting the vlookup to accept it!

Any ideas or suggestions appreciated!

Thanks







 
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
Do Vlookup calculate quicker using named ranges?! WhytheQ Excel Worksheet Functions 2 November 16th 07 04:31 PM
Formula To Use A Dynamic Named Ranges With VLOOKUP On Different Workbooks Minitman Excel Worksheet Functions 6 August 28th 07 12:18 AM
can VLOOKUP use dynamic named ranges? Dave F Excel Discussion (Misc queries) 2 November 23rd 06 02:34 PM
vlookup and named ranges chathag Excel Worksheet Functions 3 November 22nd 04 04:07 PM
vlookup and named ranges Domenic Excel Worksheet Functions 0 November 16th 04 04:08 PM


All times are GMT +1. The time now is 04:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"