Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Vlookup formula entered by VBA, returns from another worksheet

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Vlookup formula entered by VBA, returns from another worksheet

thank you - that certainly works and helps.

the thing that i cannot see is how i can vlookup from another workbook
(apologies this probably want clear).

i imagine that this section would need altering: FormulaR1C1 =
"=VLOOKUP(Sheet2!RC1,tablearray,3,False)

but i cant seem to get it rollin' ok.....? Any idea, and thank you for the
lsat post!

"Patrick Molloy" wrote:

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?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Vlookup formula entered by VBA, returns from another worksheet

Record a macro when you create that formula manually.

If the sending workbook is closed, then close the sending workbook and pretend
to edit that range (hit F2 followed by the Enter key is enough).

If that doesn't help, then share that recorded macro.

Withnails wrote:

thank you - that certainly works and helps.

the thing that i cannot see is how i can vlookup from another workbook
(apologies this probably want clear).

i imagine that this section would need altering: FormulaR1C1 =
"=VLOOKUP(Sheet2!RC1,tablearray,3,False)

but i cant seem to get it rollin' ok.....? Any idea, and thank you for the
lsat post!

"Patrick Molloy" wrote:

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?


--

Dave Peterson
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
VLOOKUP worksheet function returns zero for empty cells Hershmab Excel Worksheet Functions 4 April 12th 12 07:48 PM
vlookup returns formula instead of value mmurph Excel Worksheet Functions 5 April 4th 08 01:03 AM
Array formula returns blank in the cell where it is entered [email protected] Excel Worksheet Functions 1 July 27th 06 04:25 PM
Vlookup macro that returns data from worksheet, then Loops xlsxlsxls[_3_] Excel Programming 4 October 23rd 04 05:48 PM
Vlookup macro that returns data from worksheet, then Loops xlsxlsxls[_4_] Excel Programming 0 October 23rd 04 05:43 PM


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