Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to automatically change the referenced worksheet name in all formulas?

Hi,

I have a worksheet (call it "formulas") that has a series of formulas
that work on data from another worksheet ("data 1"). I would like to
write a VBA function that automatically updates all the formulas that
reference the "data 1" worksheet on the "formulas" worksheet, to
reference a new data sheet ("data 2").

"Data 1" and "Data 2" are identical in structure, they just have
slightly different data. Therefore the cell references can remain the
same, it is just the worksheet reference that needs to change.

Please could someone tell me what the best way to do this is?

Thanks in advance,
Steve

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How to automatically change the referenced worksheet name in all formulas?

You can do it manually with a search and replace just highlight all the
cells and press Ctrl + H, treat with care as if you are not specific
enough in what you search for you could get unexpected results.

I.e. to take your example replace "Data 1" with "Data 2" if you replace
"1" with "2" then the references elsewhere in the formulae will become
corrupted.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default How to automatically change the referenced worksheet name in all f

You may like to look at the Indirect function. Using this function you can
construct a reference to another worksheet using a formula. For instance if
you use the following formula

=Indirect(A1 & "!B1") then the formula will refer to Data 1's Cell B1 if the
Cell A1 contains Data 1 but will refer to Data 2's cell B1 if A1 contains the
value Data 2.

Alok Joshi

" wrote:

Hi,

I have a worksheet (call it "formulas") that has a series of formulas
that work on data from another worksheet ("data 1"). I would like to
write a VBA function that automatically updates all the formulas that
reference the "data 1" worksheet on the "formulas" worksheet, to
reference a new data sheet ("data 2").

"Data 1" and "Data 2" are identical in structure, they just have
slightly different data. Therefore the cell references can remain the
same, it is just the worksheet reference that needs to change.

Please could someone tell me what the best way to do this is?

Thanks in advance,
Steve


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
Formulas Aren't Automatically Updating When Cells Change chris Excel Discussion (Misc queries) 6 April 5th 23 02:51 PM
Automatically change sequential worksheet names in formulas Magnum Excel Worksheet Functions 3 February 11th 08 10:33 PM
how do I change cell references automatically in formulas jnw3 Charts and Charting in Excel 1 August 24th 06 09:45 PM
Has anyone had formulas change automatically with no explanation? DavidA3878 Excel Worksheet Functions 1 November 2nd 05 12:42 AM
Automatically pasting worksheet data to new worksheet with formulas COntactJason Excel Worksheet Functions 0 August 10th 05 08:22 PM


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