LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Columns as variable in Vlookup

On Sunday, June 23, 2013 2:05:08 PM UTC-7, CellShocked wrote:
On Sat, 22 Jun 2013 07:39:26 +0200, Claus Busch

wrote:



Hi Howard,




Am Fri, 21 Jun 2013 17:04:28 -0700 (PDT) schrieb Howard:




<How do I translate the Long returned by loc_1 and lcol




try:


Sub Vx_x()




Dim lcol As Long


Dim lcol_1 As Long


Dim LRow As Long




With ActiveSheet


lcol_1 = .Cells(1, .Columns.Count).End(xlToLeft).Column - 1


lcol = .Cells(1, .Columns.Count).End(xlToLeft).Column


LRow = .Cells(.Rows.Count, 1).End(xlUp).Row




.Range("G12").Formula = "=vlookup(F12," & _


Range(Cells(1, lcol_1), Cells(LRow, lcol)).Address & ",2,0)"


End With


End Sub




Regards


Claus Busch






Assign a cell a range name and place the column number in that cell,

and make the vlookup statement refer to that rangename to gather the

column number. Then, you can use custom dropdown lists to create dynamic

vlookups.


I think I see where you are going with this. I'll toil with it. Hard to beat Claus' solution though.

Thanks, CellShocked.

Regards,
Howard
 
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
vlookup with variable David Excel Programming 2 April 19th 09 04:31 PM
Vlookup using a variable for the workbook name Phil Excel Discussion (Misc queries) 4 November 10th 08 09:30 PM
vlookup with a variable Mentos Excel Programming 2 July 17th 08 10:18 AM
vlookup using a variable Tom Ogilvy Excel Programming 1 September 15th 04 11:01 PM
variable vlookup Tom Ogilvy Excel Programming 2 September 8th 03 02:58 PM


All times are GMT +1. The time now is 01:59 AM.

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"