View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Howard Howard is offline
external usenet poster
 
Posts: 536
Default Columns as variable in Vlookup

On Friday, June 21, 2013 10:39:26 PM UTC-7, 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


Thanks as always, Claus. Very nice!

Regards,
Howard