Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 287
Default refer to worksheet by index number in formula

Hi

I'm trying to have a Vlookup formula inserted by a macro, but if possibly I
want to refer to the range by worksheet index number - the sheet will always
be in the same spot, but won't always be called the same thing. The line is a
simple one:
ActiveCell.FormulaR1C1 = "=Vlookup(RC[-1],'Sheet2'!R1C1:R100C19,11)". Is
there a way to refer to Sheet2 by it's index number, or another way to set up
the formula so it works?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 415
Default refer to worksheet by index number in formula

Aaron,
As you are using a macro to build your formula string, you can get the name
from the index
ActiveCell.FormulaR1C1 = "=Vlookup(RC[-1],'" & Worksheets(1).Name &
"'!R1C1:R100C19,11)"

NickHK

"Aaron" ...
Hi

I'm trying to have a Vlookup formula inserted by a macro, but if possibly
I
want to refer to the range by worksheet index number - the sheet will
always
be in the same spot, but won't always be called the same thing. The line
is a
simple one:
ActiveCell.FormulaR1C1 = "=Vlookup(RC[-1],'Sheet2'!R1C1:R100C19,11)". Is
there a way to refer to Sheet2 by it's index number, or another way to set
up
the formula so it works?

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 287
Default refer to worksheet by index number in formula

Thanks, Nick, worked perfectly.

"NickHK" wrote:

Aaron,
As you are using a macro to build your formula string, you can get the name
from the index
ActiveCell.FormulaR1C1 = "=Vlookup(RC[-1],'" & Worksheets(1).Name &
"'!R1C1:R100C19,11)"

NickHK

"Aaron" ...
Hi

I'm trying to have a Vlookup formula inserted by a macro, but if possibly
I
want to refer to the range by worksheet index number - the sheet will
always
be in the same spot, but won't always be called the same thing. The line
is a
simple one:
ActiveCell.FormulaR1C1 = "=Vlookup(RC[-1],'Sheet2'!R1C1:R100C19,11)". Is
there a way to refer to Sheet2 by it's index number, or another way to set
up
the formula so it works?

Thanks




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
How do I refer to cell in another worksheet in a formula Jim Excel Worksheet Functions 2 October 11th 08 10:37 PM
Refer to the previous worksheet in a formula Shazzer Excel Worksheet Functions 3 December 15th 06 02:07 PM
Worksheet function to refer to columns by number mcambrose Excel Discussion (Misc queries) 1 October 13th 06 05:28 PM
Getting the index number by supplying worksheet name ajitpalsingh200[_19_] Excel Programming 1 November 24th 04 05:00 AM
Formula to refer to other worksheet... Liz-In-USA Excel Worksheet Functions 4 November 9th 04 10:51 PM


All times are GMT +1. The time now is 07:54 AM.

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

About Us

"It's about Microsoft Excel"