View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_2_] Patrick Molloy[_2_] is offline
external usenet poster
 
Posts: 1,298
Default Vlookup formula entered by VBA, returns from another worksheet

is the tablearray range named? I'll assume name it's tablearray here


with worksheets("sheet3")
WITH .Range( .Range("D2"), .Range("C2").End(xlDown).Offset(,1) )
.FormulaR1C1 = "=VLOOKUP(Sheet2!RC1,tablearray,3,False)
END WITH
end with

you aren't too clear . Ie is teh item to be found in column A of sheet2? If
its column C of sheet3 use
.FormulaR1C1 = "=VLOOKUP(RC3,tablearray,3,False)


hope this help anyway




"Withnails" wrote:

Hi
I am looking to enter a vlookup formula into sheet3 of a workbook. the
formula should start in cell D2 and continue down as far as there are
populated cells in columnC. The lookup value is in column A, the table array
in a different work sheet, and the col_index_num is D2 dowards (eg 4), the
lookup value also being in column A in this other worksheet.
As you can imagine, this is a bit beyond my limited VBA skills.... can you
help?