A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Links and Linking
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Passing Variables into Links



 
 
Thread Tools Display Modes
  #1  
Old October 9th, 2003, 09:41 AM
Alec
external usenet poster
 
Posts: n/a
Default Passing Variables into Links

I have written VB code that, on the press of a pushbutton,
creates new sheets from a template, it also puts the sheet
name in cell A1 of the new sheet.
I also have a Summary Sheet, and when I press the add
sheet pushbutton a Range is copied from a list on another
sheet and inserted on the Summary Sheet with the new sheet
name included, also included in this newly pasted range,
is a link to the new sheet.
My query is, is it possible to use the new sheet name as a
variable and use it in the newly created link, for
example:-

A cell eg "'Summary Sheet'!F2" contains the text "Panel 1"
The link in "'Summary Sheet'!F3" is "='Panel 1'!C2"

I want to replace the text "Panel 1" in the link, with a
variable that will reference the contents of "'Summary
Sheet'!F2.

I have managed to do this in VB, but the code can get
messy as the number of sheets increase.
I have also tried other methods of inserting a variable in
a link, including the ADDRESS and CELL functions, but with
no success.

I would be grateful for any suggestions.

  #2  
Old October 12th, 2003, 07:51 PM
Tom Ogilvy
external usenet poster
 
Posts: n/a
Default Passing Variables into Links

=indirect("'" & 'Summary Sheet'!F2 & "'!C2")

--
Regards,
Tom Ogilvy

Alec wrote in message
...
I have written VB code that, on the press of a pushbutton,
creates new sheets from a template, it also puts the sheet
name in cell A1 of the new sheet.
I also have a Summary Sheet, and when I press the add
sheet pushbutton a Range is copied from a list on another
sheet and inserted on the Summary Sheet with the new sheet
name included, also included in this newly pasted range,
is a link to the new sheet.
My query is, is it possible to use the new sheet name as a
variable and use it in the newly created link, for
example:-

A cell eg "'Summary Sheet'!F2" contains the text "Panel 1"
The link in "'Summary Sheet'!F3" is "='Panel 1'!C2"

I want to replace the text "Panel 1" in the link, with a
variable that will reference the contents of "'Summary
Sheet'!F2.

I have managed to do this in VB, but the code can get
messy as the number of sheets increase.
I have also tried other methods of inserting a variable in
a link, including the ADDRESS and CELL functions, but with
no success.

I would be grateful for any suggestions.



  #3  
Old October 15th, 2003, 10:20 AM
external usenet poster
 
Posts: n/a
Default Passing Variables into Links

Thanks Tom, it works a treat.

Best Regards
Alec

-----Original Message-----
=indirect("'" & 'Summary Sheet'!F2 & "'!C2")

--
Regards,
Tom Ogilvy

Alec wrote in message
...
I have written VB code that, on the press of a

pushbutton,
creates new sheets from a template, it also puts the

sheet
name in cell A1 of the new sheet.
I also have a Summary Sheet, and when I press the add
sheet pushbutton a Range is copied from a list on

another
sheet and inserted on the Summary Sheet with the new

sheet
name included, also included in this newly pasted range,
is a link to the new sheet.
My query is, is it possible to use the new sheet name

as a
variable and use it in the newly created link, for
example:-

A cell eg "'Summary Sheet'!F2" contains the text "Panel

1"
The link in "'Summary Sheet'!F3" is "='Panel 1'!C2"

I want to replace the text "Panel 1" in the link, with a
variable that will reference the contents of "'Summary
Sheet'!F2.

I have managed to do this in VB, but the code can get
messy as the number of sheets increase.
I have also tried other methods of inserting a variable

in
a link, including the ADDRESS and CELL functions, but

with
no success.

I would be grateful for any suggestions.



.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:40 PM.


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