Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 53
Default Cell in new sheet should always refer to defined cell in another s

Hi,

How can I make a cell on a worksheet always accept input from a certain cell
on any new copy of another worksheet?

In Excel 2003 I have made a workbook which I could use as a template, but I
would like to just have one book for multiple transactions, each on a newly
created sheet.

Base figures and calculations are on two sheets. One is protected with the
user allwed to modify one unlocked cell only. The other is protected with no
edits allowed. These sheets accept information from and display results on a
third sheet.

The third sheet is also protected, but the user can enter a variety of
required information in certain cells, which pass the user input back to the
two sheets containing the base calculations and formulae, and obtains the
results from them. Results are displayed in non editable cells. I intend
this sheet to be a template sheet so that using the Move or Copy context menu
the user can create and name a new sheet for a new transaction. The
information is passed about by Copy Paste Special Paste Link.

The problem is that when I make a new copy of the third woksheet, the input
is not passed back to the base sheets, as those sheets only reference the
original third sheet.

I have looked at 3d references, but a predetermined number of worksheets
must exist for that to work.

I'd be grateful for any advice on this.

Regards




  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 118
Default Cell in new sheet should always refer to defined cell in another s

Hi Ronnie

The only way I can think to do this requires a little VBA. Basically
wherever you need to reference your "third" sheet in the first or second
sheets you use the "Activesheet" and "Range" properties to put the correct
numbers in their respective places.

Here's my simple example. I have two workbooks called "MyWB1.xls" and
"MyWB2.xls". In MyWB1 I want cell A1 to have the same value as A1 in MyWB2
and I want cell A3 to have the same value as A2 in MyWB2. So here's the code
that is written to MyWB2 (which would be your "third" sheet).

Sub UpdateValues()
With Workbooks("MyWB1.xlsx").Worksheets(1)
.Range("A1").Value = ThisWorkbook.ActiveSheet.Range("A1").Value
.Range("A3").Value = ThisWorkbook.ActiveSheet.Range("A2").Value
End With
End Sub

Now all you do on your third sheet is insert a shape (anything you like),
right click and then "Assign Macro". You assign the above macro. Now when
someone copies this sheet, they copy the button as well. They can modify the
values and then simply click the button to do the calculation.

If this is helpful click yes.
Rick

"Ronnie" wrote:

Hi,

How can I make a cell on a worksheet always accept input from a certain cell
on any new copy of another worksheet?

In Excel 2003 I have made a workbook which I could use as a template, but I
would like to just have one book for multiple transactions, each on a newly
created sheet.

Base figures and calculations are on two sheets. One is protected with the
user allwed to modify one unlocked cell only. The other is protected with no
edits allowed. These sheets accept information from and display results on a
third sheet.

The third sheet is also protected, but the user can enter a variety of
required information in certain cells, which pass the user input back to the
two sheets containing the base calculations and formulae, and obtains the
results from them. Results are displayed in non editable cells. I intend
this sheet to be a template sheet so that using the Move or Copy context menu
the user can create and name a new sheet for a new transaction. The
information is passed about by Copy Paste Special Paste Link.

The problem is that when I make a new copy of the third woksheet, the input
is not passed back to the base sheets, as those sheets only reference the
original third sheet.

I have looked at 3d references, but a predetermined number of worksheets
must exist for that to work.

I'd be grateful for any advice on this.

Regards




  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 53
Default Cell in new sheet should always refer to defined cell in anoth

Thank you Rick,

That is very helpfull and seems to be exactly what I want to do.

However I get a "Compile Error: Expected: List Seperator or )" when I code
the following:

Sub UpdateValues()
With Workbooks("TEST VB Price Analytics 10pc.xls").Worksheets(Base
Figures)
.Range("G3").Value = ThisWorkbook.ActiveSheet.Range("B19").Value
.Range("I3").Value = ThisWorkbook.ActiveSheet.Range("B31").Value
End With
End Sub

Where the Workbook is called 'TEST VB Price Analytics 10pc.xls', The Sheet I
want the Macro on (my third sheet) is 'Form' and the sheet where the
calculations are done (my first sheet) is Base Figures.

If I save the Macro as it stands, with errors, when I click the Shape on the
worksheet 'Form' it reoprts 'The macro "TEST VB Price Analytics
10pc.xls'!Picture3_Click' cnnot be found.

Can you see at a glance what I am doing wrong?

Thank you for your help - I am a complete newbie at Macros and VB.

Regards

Ronnie.



"BSc Chem Eng Rick" wrote:

Hi Ronnie

The only way I can think to do this requires a little VBA. Basically
wherever you need to reference your "third" sheet in the first or second
sheets you use the "Activesheet" and "Range" properties to put the correct
numbers in their respective places.

Here's my simple example. I have two workbooks called "MyWB1.xls" and
"MyWB2.xls". In MyWB1 I want cell A1 to have the same value as A1 in MyWB2
and I want cell A3 to have the same value as A2 in MyWB2. So here's the code
that is written to MyWB2 (which would be your "third" sheet).

Sub UpdateValues()
With Workbooks("MyWB1.xlsx").Worksheets(1)
.Range("A1").Value = ThisWorkbook.ActiveSheet.Range("A1").Value
.Range("A3").Value = ThisWorkbook.ActiveSheet.Range("A2").Value
End With
End Sub

Now all you do on your third sheet is insert a shape (anything you like),
right click and then "Assign Macro". You assign the above macro. Now when
someone copies this sheet, they copy the button as well. They can modify the
values and then simply click the button to do the calculation.

If this is helpful click yes.
Rick

"Ronnie" wrote:

Hi,

How can I make a cell on a worksheet always accept input from a certain cell
on any new copy of another worksheet?

In Excel 2003 I have made a workbook which I could use as a template, but I
would like to just have one book for multiple transactions, each on a newly
created sheet.

Base figures and calculations are on two sheets. One is protected with the
user allwed to modify one unlocked cell only. The other is protected with no
edits allowed. These sheets accept information from and display results on a
third sheet.

The third sheet is also protected, but the user can enter a variety of
required information in certain cells, which pass the user input back to the
two sheets containing the base calculations and formulae, and obtains the
results from them. Results are displayed in non editable cells. I intend
this sheet to be a template sheet so that using the Move or Copy context menu
the user can create and name a new sheet for a new transaction. The
information is passed about by Copy Paste Special Paste Link.

The problem is that when I make a new copy of the third woksheet, the input
is not passed back to the base sheets, as those sheets only reference the
original third sheet.

I have looked at 3d references, but a predetermined number of worksheets
must exist for that to work.

I'd be grateful for any advice on this.

Regards




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 118
Default Cell in new sheet should always refer to defined cell in anoth

Glad I could help.

The compile error is being generated because you haven't got the worksheet
name enclosed in double quotes as follows: Worksheets("Base Figures"). That
should sort both problems out.

"Ronnie" wrote:

Thank you Rick,

That is very helpfull and seems to be exactly what I want to do.

However I get a "Compile Error: Expected: List Seperator or )" when I code
the following:

Sub UpdateValues()
With Workbooks("TEST VB Price Analytics 10pc.xls").Worksheets(Base
Figures)
.Range("G3").Value = ThisWorkbook.ActiveSheet.Range("B19").Value
.Range("I3").Value = ThisWorkbook.ActiveSheet.Range("B31").Value
End With
End Sub

Where the Workbook is called 'TEST VB Price Analytics 10pc.xls', The Sheet I
want the Macro on (my third sheet) is 'Form' and the sheet where the
calculations are done (my first sheet) is Base Figures.

If I save the Macro as it stands, with errors, when I click the Shape on the
worksheet 'Form' it reoprts 'The macro "TEST VB Price Analytics
10pc.xls'!Picture3_Click' cnnot be found.

Can you see at a glance what I am doing wrong?

Thank you for your help - I am a complete newbie at Macros and VB.

Regards

Ronnie.



"BSc Chem Eng Rick" wrote:

Hi Ronnie

The only way I can think to do this requires a little VBA. Basically
wherever you need to reference your "third" sheet in the first or second
sheets you use the "Activesheet" and "Range" properties to put the correct
numbers in their respective places.

Here's my simple example. I have two workbooks called "MyWB1.xls" and
"MyWB2.xls". In MyWB1 I want cell A1 to have the same value as A1 in MyWB2
and I want cell A3 to have the same value as A2 in MyWB2. So here's the code
that is written to MyWB2 (which would be your "third" sheet).

Sub UpdateValues()
With Workbooks("MyWB1.xlsx").Worksheets(1)
.Range("A1").Value = ThisWorkbook.ActiveSheet.Range("A1").Value
.Range("A3").Value = ThisWorkbook.ActiveSheet.Range("A2").Value
End With
End Sub

Now all you do on your third sheet is insert a shape (anything you like),
right click and then "Assign Macro". You assign the above macro. Now when
someone copies this sheet, they copy the button as well. They can modify the
values and then simply click the button to do the calculation.

If this is helpful click yes.
Rick

"Ronnie" wrote:

Hi,

How can I make a cell on a worksheet always accept input from a certain cell
on any new copy of another worksheet?

In Excel 2003 I have made a workbook which I could use as a template, but I
would like to just have one book for multiple transactions, each on a newly
created sheet.

Base figures and calculations are on two sheets. One is protected with the
user allwed to modify one unlocked cell only. The other is protected with no
edits allowed. These sheets accept information from and display results on a
third sheet.

The third sheet is also protected, but the user can enter a variety of
required information in certain cells, which pass the user input back to the
two sheets containing the base calculations and formulae, and obtains the
results from them. Results are displayed in non editable cells. I intend
this sheet to be a template sheet so that using the Move or Copy context menu
the user can create and name a new sheet for a new transaction. The
information is passed about by Copy Paste Special Paste Link.

The problem is that when I make a new copy of the third woksheet, the input
is not passed back to the base sheets, as those sheets only reference the
original third sheet.

I have looked at 3d references, but a predetermined number of worksheets
must exist for that to work.

I'd be grateful for any advice on this.

Regards




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 53
Default Cell in new sheet should always refer to defined cell in anoth

Thank you once again Rick!

I've corrected that, and also found that I needed to assign the macro as
'UpdateValues' to the image in order for the workbook to find it.

However I now get a Run-Time Error '1004' , which 'Help' does not help with.
The debugger stops at:

..Range("G3").Value = ThisWorkbook.ActiveSheet.Range("B19").Value

so I assume that there is something wrong with my statements or arguments on
this and the following line.

I'd be grateful for your further thoughts!

Regards

Ronnie.

"BSc Chem Eng Rick" wrote:

Glad I could help.

The compile error is being generated because you haven't got the worksheet
name enclosed in double quotes as follows: Worksheets("Base Figures"). That
should sort both problems out.

"Ronnie" wrote:

Thank you Rick,

That is very helpfull and seems to be exactly what I want to do.

However I get a "Compile Error: Expected: List Seperator or )" when I code
the following:

Sub UpdateValues()
With Workbooks("TEST VB Price Analytics 10pc.xls").Worksheets(Base
Figures)
.Range("G3").Value = ThisWorkbook.ActiveSheet.Range("B19").Value
.Range("I3").Value = ThisWorkbook.ActiveSheet.Range("B31").Value
End With
End Sub

Where the Workbook is called 'TEST VB Price Analytics 10pc.xls', The Sheet I
want the Macro on (my third sheet) is 'Form' and the sheet where the
calculations are done (my first sheet) is Base Figures.

If I save the Macro as it stands, with errors, when I click the Shape on the
worksheet 'Form' it reoprts 'The macro "TEST VB Price Analytics
10pc.xls'!Picture3_Click' cnnot be found.

Can you see at a glance what I am doing wrong?

Thank you for your help - I am a complete newbie at Macros and VB.

Regards

Ronnie.



"BSc Chem Eng Rick" wrote:

Hi Ronnie

The only way I can think to do this requires a little VBA. Basically
wherever you need to reference your "third" sheet in the first or second
sheets you use the "Activesheet" and "Range" properties to put the correct
numbers in their respective places.

Here's my simple example. I have two workbooks called "MyWB1.xls" and
"MyWB2.xls". In MyWB1 I want cell A1 to have the same value as A1 in MyWB2
and I want cell A3 to have the same value as A2 in MyWB2. So here's the code
that is written to MyWB2 (which would be your "third" sheet).

Sub UpdateValues()
With Workbooks("MyWB1.xlsx").Worksheets(1)
.Range("A1").Value = ThisWorkbook.ActiveSheet.Range("A1").Value
.Range("A3").Value = ThisWorkbook.ActiveSheet.Range("A2").Value
End With
End Sub

Now all you do on your third sheet is insert a shape (anything you like),
right click and then "Assign Macro". You assign the above macro. Now when
someone copies this sheet, they copy the button as well. They can modify the
values and then simply click the button to do the calculation.

If this is helpful click yes.
Rick

"Ronnie" wrote:

Hi,

How can I make a cell on a worksheet always accept input from a certain cell
on any new copy of another worksheet?

In Excel 2003 I have made a workbook which I could use as a template, but I
would like to just have one book for multiple transactions, each on a newly
created sheet.

Base figures and calculations are on two sheets. One is protected with the
user allwed to modify one unlocked cell only. The other is protected with no
edits allowed. These sheets accept information from and display results on a
third sheet.

The third sheet is also protected, but the user can enter a variety of
required information in certain cells, which pass the user input back to the
two sheets containing the base calculations and formulae, and obtains the
results from them. Results are displayed in non editable cells. I intend
this sheet to be a template sheet so that using the Move or Copy context menu
the user can create and name a new sheet for a new transaction. The
information is passed about by Copy Paste Special Paste Link.

The problem is that when I make a new copy of the third woksheet, the input
is not passed back to the base sheets, as those sheets only reference the
original third sheet.

I have looked at 3d references, but a predetermined number of worksheets
must exist for that to work.

I'd be grateful for any advice on this.

Regards






  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 118
Default Cell in new sheet should always refer to defined cell in anoth

No surprise with help not helping ;)
You mentioned your sheets were protected, this may be preventing the macro
from writing to the protected cells. Just try and unprotect them and see if
it at least allows you to run the macro because it runs ok on my side.

"Ronnie" wrote:

Thank you once again Rick!

I've corrected that, and also found that I needed to assign the macro as
'UpdateValues' to the image in order for the workbook to find it.

However I now get a Run-Time Error '1004' , which 'Help' does not help with.
The debugger stops at:

.Range("G3").Value = ThisWorkbook.ActiveSheet.Range("B19").Value

so I assume that there is something wrong with my statements or arguments on
this and the following line.

I'd be grateful for your further thoughts!

Regards

Ronnie.

"BSc Chem Eng Rick" wrote:

Glad I could help.

The compile error is being generated because you haven't got the worksheet
name enclosed in double quotes as follows: Worksheets("Base Figures"). That
should sort both problems out.

"Ronnie" wrote:

Thank you Rick,

That is very helpfull and seems to be exactly what I want to do.

However I get a "Compile Error: Expected: List Seperator or )" when I code
the following:

Sub UpdateValues()
With Workbooks("TEST VB Price Analytics 10pc.xls").Worksheets(Base
Figures)
.Range("G3").Value = ThisWorkbook.ActiveSheet.Range("B19").Value
.Range("I3").Value = ThisWorkbook.ActiveSheet.Range("B31").Value
End With
End Sub

Where the Workbook is called 'TEST VB Price Analytics 10pc.xls', The Sheet I
want the Macro on (my third sheet) is 'Form' and the sheet where the
calculations are done (my first sheet) is Base Figures.

If I save the Macro as it stands, with errors, when I click the Shape on the
worksheet 'Form' it reoprts 'The macro "TEST VB Price Analytics
10pc.xls'!Picture3_Click' cnnot be found.

Can you see at a glance what I am doing wrong?

Thank you for your help - I am a complete newbie at Macros and VB.

Regards

Ronnie.



"BSc Chem Eng Rick" wrote:

Hi Ronnie

The only way I can think to do this requires a little VBA. Basically
wherever you need to reference your "third" sheet in the first or second
sheets you use the "Activesheet" and "Range" properties to put the correct
numbers in their respective places.

Here's my simple example. I have two workbooks called "MyWB1.xls" and
"MyWB2.xls". In MyWB1 I want cell A1 to have the same value as A1 in MyWB2
and I want cell A3 to have the same value as A2 in MyWB2. So here's the code
that is written to MyWB2 (which would be your "third" sheet).

Sub UpdateValues()
With Workbooks("MyWB1.xlsx").Worksheets(1)
.Range("A1").Value = ThisWorkbook.ActiveSheet.Range("A1").Value
.Range("A3").Value = ThisWorkbook.ActiveSheet.Range("A2").Value
End With
End Sub

Now all you do on your third sheet is insert a shape (anything you like),
right click and then "Assign Macro". You assign the above macro. Now when
someone copies this sheet, they copy the button as well. They can modify the
values and then simply click the button to do the calculation.

If this is helpful click yes.
Rick

"Ronnie" wrote:

Hi,

How can I make a cell on a worksheet always accept input from a certain cell
on any new copy of another worksheet?

In Excel 2003 I have made a workbook which I could use as a template, but I
would like to just have one book for multiple transactions, each on a newly
created sheet.

Base figures and calculations are on two sheets. One is protected with the
user allwed to modify one unlocked cell only. The other is protected with no
edits allowed. These sheets accept information from and display results on a
third sheet.

The third sheet is also protected, but the user can enter a variety of
required information in certain cells, which pass the user input back to the
two sheets containing the base calculations and formulae, and obtains the
results from them. Results are displayed in non editable cells. I intend
this sheet to be a template sheet so that using the Move or Copy context menu
the user can create and name a new sheet for a new transaction. The
information is passed about by Copy Paste Special Paste Link.

The problem is that when I make a new copy of the third woksheet, the input
is not passed back to the base sheets, as those sheets only reference the
original third sheet.

I have looked at 3d references, but a predetermined number of worksheets
must exist for that to work.

I'd be grateful for any advice on this.

Regards




  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 53
Default Cell in new sheet should always refer to defined cell in anoth

Rick that is brilliant! Thank you very much.

I have unlocked just the cells I need to update, and protected the sheet
allowing users to select unlocked cells. It works perfectly now, and I can
create the new sheets as intended.

I really should have thought of the protection issue myself, but many thanks
for your expert help.

Best Wishes

Ronnie.

"BSc Chem Eng Rick" wrote:

No surprise with help not helping ;)
You mentioned your sheets were protected, this may be preventing the macro
from writing to the protected cells. Just try and unprotect them and see if
it at least allows you to run the macro because it runs ok on my side.

"Ronnie" wrote:

Thank you once again Rick!

I've corrected that, and also found that I needed to assign the macro as
'UpdateValues' to the image in order for the workbook to find it.

However I now get a Run-Time Error '1004' , which 'Help' does not help with.
The debugger stops at:

.Range("G3").Value = ThisWorkbook.ActiveSheet.Range("B19").Value

so I assume that there is something wrong with my statements or arguments on
this and the following line.

I'd be grateful for your further thoughts!

Regards

Ronnie.

"BSc Chem Eng Rick" wrote:

Glad I could help.

The compile error is being generated because you haven't got the worksheet
name enclosed in double quotes as follows: Worksheets("Base Figures"). That
should sort both problems out.

"Ronnie" wrote:

Thank you Rick,

That is very helpfull and seems to be exactly what I want to do.

However I get a "Compile Error: Expected: List Seperator or )" when I code
the following:

Sub UpdateValues()
With Workbooks("TEST VB Price Analytics 10pc.xls").Worksheets(Base
Figures)
.Range("G3").Value = ThisWorkbook.ActiveSheet.Range("B19").Value
.Range("I3").Value = ThisWorkbook.ActiveSheet.Range("B31").Value
End With
End Sub

Where the Workbook is called 'TEST VB Price Analytics 10pc.xls', The Sheet I
want the Macro on (my third sheet) is 'Form' and the sheet where the
calculations are done (my first sheet) is Base Figures.

If I save the Macro as it stands, with errors, when I click the Shape on the
worksheet 'Form' it reoprts 'The macro "TEST VB Price Analytics
10pc.xls'!Picture3_Click' cnnot be found.

Can you see at a glance what I am doing wrong?

Thank you for your help - I am a complete newbie at Macros and VB.

Regards

Ronnie.



"BSc Chem Eng Rick" wrote:

Hi Ronnie

The only way I can think to do this requires a little VBA. Basically
wherever you need to reference your "third" sheet in the first or second
sheets you use the "Activesheet" and "Range" properties to put the correct
numbers in their respective places.

Here's my simple example. I have two workbooks called "MyWB1.xls" and
"MyWB2.xls". In MyWB1 I want cell A1 to have the same value as A1 in MyWB2
and I want cell A3 to have the same value as A2 in MyWB2. So here's the code
that is written to MyWB2 (which would be your "third" sheet).

Sub UpdateValues()
With Workbooks("MyWB1.xlsx").Worksheets(1)
.Range("A1").Value = ThisWorkbook.ActiveSheet.Range("A1").Value
.Range("A3").Value = ThisWorkbook.ActiveSheet.Range("A2").Value
End With
End Sub

Now all you do on your third sheet is insert a shape (anything you like),
right click and then "Assign Macro". You assign the above macro. Now when
someone copies this sheet, they copy the button as well. They can modify the
values and then simply click the button to do the calculation.

If this is helpful click yes.
Rick

"Ronnie" wrote:

Hi,

How can I make a cell on a worksheet always accept input from a certain cell
on any new copy of another worksheet?

In Excel 2003 I have made a workbook which I could use as a template, but I
would like to just have one book for multiple transactions, each on a newly
created sheet.

Base figures and calculations are on two sheets. One is protected with the
user allwed to modify one unlocked cell only. The other is protected with no
edits allowed. These sheets accept information from and display results on a
third sheet.

The third sheet is also protected, but the user can enter a variety of
required information in certain cells, which pass the user input back to the
two sheets containing the base calculations and formulae, and obtains the
results from them. Results are displayed in non editable cells. I intend
this sheet to be a template sheet so that using the Move or Copy context menu
the user can create and name a new sheet for a new transaction. The
information is passed about by Copy Paste Special Paste Link.

The problem is that when I make a new copy of the third woksheet, the input
is not passed back to the base sheets, as those sheets only reference the
original third sheet.

I have looked at 3d references, but a predetermined number of worksheets
must exist for that to work.

I'd be grateful for any advice on this.

Regards




  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 118
Default Cell in new sheet should always refer to defined cell in anoth

My pleasure.

And just in case you are interested you can protect and unprotect your
worksheets in the macro itself. But obviously be careful of this because as
you will see below you need to include the password written out. Here is a
macro which unprotects "Sheet1" then calls our UpdateValues macro and when
that's finished it Protects the workbook again with the same password.

Sub SheetUnlock()
Workbooks("MyWB").Worksheets("Sheet1").Unprotect(" MyPassword")
UpdateValues
Workbooks("MyWB").Worksheets("Sheet1").Protect("My Password")
End Sub

"Ronnie" wrote:

Rick that is brilliant! Thank you very much.

I have unlocked just the cells I need to update, and protected the sheet
allowing users to select unlocked cells. It works perfectly now, and I can
create the new sheets as intended.

I really should have thought of the protection issue myself, but many thanks
for your expert help.

Best Wishes

Ronnie.

"BSc Chem Eng Rick" wrote:

No surprise with help not helping ;)
You mentioned your sheets were protected, this may be preventing the macro
from writing to the protected cells. Just try and unprotect them and see if
it at least allows you to run the macro because it runs ok on my side.

"Ronnie" wrote:

Thank you once again Rick!

I've corrected that, and also found that I needed to assign the macro as
'UpdateValues' to the image in order for the workbook to find it.

However I now get a Run-Time Error '1004' , which 'Help' does not help with.
The debugger stops at:

.Range("G3").Value = ThisWorkbook.ActiveSheet.Range("B19").Value

so I assume that there is something wrong with my statements or arguments on
this and the following line.

I'd be grateful for your further thoughts!

Regards

Ronnie.

"BSc Chem Eng Rick" wrote:

Glad I could help.

The compile error is being generated because you haven't got the worksheet
name enclosed in double quotes as follows: Worksheets("Base Figures"). That
should sort both problems out.

"Ronnie" wrote:

Thank you Rick,

That is very helpfull and seems to be exactly what I want to do.

However I get a "Compile Error: Expected: List Seperator or )" when I code
the following:

Sub UpdateValues()
With Workbooks("TEST VB Price Analytics 10pc.xls").Worksheets(Base
Figures)
.Range("G3").Value = ThisWorkbook.ActiveSheet.Range("B19").Value
.Range("I3").Value = ThisWorkbook.ActiveSheet.Range("B31").Value
End With
End Sub

Where the Workbook is called 'TEST VB Price Analytics 10pc.xls', The Sheet I
want the Macro on (my third sheet) is 'Form' and the sheet where the
calculations are done (my first sheet) is Base Figures.

If I save the Macro as it stands, with errors, when I click the Shape on the
worksheet 'Form' it reoprts 'The macro "TEST VB Price Analytics
10pc.xls'!Picture3_Click' cnnot be found.

Can you see at a glance what I am doing wrong?

Thank you for your help - I am a complete newbie at Macros and VB.

Regards

Ronnie.



"BSc Chem Eng Rick" wrote:

Hi Ronnie

The only way I can think to do this requires a little VBA. Basically
wherever you need to reference your "third" sheet in the first or second
sheets you use the "Activesheet" and "Range" properties to put the correct
numbers in their respective places.

Here's my simple example. I have two workbooks called "MyWB1.xls" and
"MyWB2.xls". In MyWB1 I want cell A1 to have the same value as A1 in MyWB2
and I want cell A3 to have the same value as A2 in MyWB2. So here's the code
that is written to MyWB2 (which would be your "third" sheet).

Sub UpdateValues()
With Workbooks("MyWB1.xlsx").Worksheets(1)
.Range("A1").Value = ThisWorkbook.ActiveSheet.Range("A1").Value
.Range("A3").Value = ThisWorkbook.ActiveSheet.Range("A2").Value
End With
End Sub

Now all you do on your third sheet is insert a shape (anything you like),
right click and then "Assign Macro". You assign the above macro. Now when
someone copies this sheet, they copy the button as well. They can modify the
values and then simply click the button to do the calculation.

If this is helpful click yes.
Rick

"Ronnie" wrote:

Hi,

How can I make a cell on a worksheet always accept input from a certain cell
on any new copy of another worksheet?

In Excel 2003 I have made a workbook which I could use as a template, but I
would like to just have one book for multiple transactions, each on a newly
created sheet.

Base figures and calculations are on two sheets. One is protected with the
user allwed to modify one unlocked cell only. The other is protected with no
edits allowed. These sheets accept information from and display results on a
third sheet.

The third sheet is also protected, but the user can enter a variety of
required information in certain cells, which pass the user input back to the
two sheets containing the base calculations and formulae, and obtains the
results from them. Results are displayed in non editable cells. I intend
this sheet to be a template sheet so that using the Move or Copy context menu
the user can create and name a new sheet for a new transaction. The
information is passed about by Copy Paste Special Paste Link.

The problem is that when I make a new copy of the third woksheet, the input
is not passed back to the base sheets, as those sheets only reference the
original third sheet.

I have looked at 3d references, but a predetermined number of worksheets
must exist for that to work.

I'd be grateful for any advice on this.

Regards




  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 53
Default Cell in new sheet should always refer to defined cell in anoth

Now that is very cool!

I'll save it and try it out. :-)

Many thanks.

"BSc Chem Eng Rick" wrote:

My pleasure.

And just in case you are interested you can protect and unprotect your
worksheets in the macro itself. But obviously be careful of this because as
you will see below you need to include the password written out. Here is a
macro which unprotects "Sheet1" then calls our UpdateValues macro and when
that's finished it Protects the workbook again with the same password.

Sub SheetUnlock()
Workbooks("MyWB").Worksheets("Sheet1").Unprotect(" MyPassword")
UpdateValues
Workbooks("MyWB").Worksheets("Sheet1").Protect("My Password")
End Sub

"Ronnie" wrote:

Rick that is brilliant! Thank you very much.

I have unlocked just the cells I need to update, and protected the sheet
allowing users to select unlocked cells. It works perfectly now, and I can
create the new sheets as intended.

I really should have thought of the protection issue myself, but many thanks
for your expert help.

Best Wishes

Ronnie.

"BSc Chem Eng Rick" wrote:

No surprise with help not helping ;)
You mentioned your sheets were protected, this may be preventing the macro
from writing to the protected cells. Just try and unprotect them and see if
it at least allows you to run the macro because it runs ok on my side.

"Ronnie" wrote:

Thank you once again Rick!

I've corrected that, and also found that I needed to assign the macro as
'UpdateValues' to the image in order for the workbook to find it.

However I now get a Run-Time Error '1004' , which 'Help' does not help with.
The debugger stops at:

.Range("G3").Value = ThisWorkbook.ActiveSheet.Range("B19").Value

so I assume that there is something wrong with my statements or arguments on
this and the following line.

I'd be grateful for your further thoughts!

Regards

Ronnie.

"BSc Chem Eng Rick" wrote:

Glad I could help.

The compile error is being generated because you haven't got the worksheet
name enclosed in double quotes as follows: Worksheets("Base Figures"). That
should sort both problems out.

"Ronnie" wrote:

Thank you Rick,

That is very helpfull and seems to be exactly what I want to do.

However I get a "Compile Error: Expected: List Seperator or )" when I code
the following:

Sub UpdateValues()
With Workbooks("TEST VB Price Analytics 10pc.xls").Worksheets(Base
Figures)
.Range("G3").Value = ThisWorkbook.ActiveSheet.Range("B19").Value
.Range("I3").Value = ThisWorkbook.ActiveSheet.Range("B31").Value
End With
End Sub

Where the Workbook is called 'TEST VB Price Analytics 10pc.xls', The Sheet I
want the Macro on (my third sheet) is 'Form' and the sheet where the
calculations are done (my first sheet) is Base Figures.

If I save the Macro as it stands, with errors, when I click the Shape on the
worksheet 'Form' it reoprts 'The macro "TEST VB Price Analytics
10pc.xls'!Picture3_Click' cnnot be found.

Can you see at a glance what I am doing wrong?

Thank you for your help - I am a complete newbie at Macros and VB.

Regards

Ronnie.



"BSc Chem Eng Rick" wrote:

Hi Ronnie

The only way I can think to do this requires a little VBA. Basically
wherever you need to reference your "third" sheet in the first or second
sheets you use the "Activesheet" and "Range" properties to put the correct
numbers in their respective places.

Here's my simple example. I have two workbooks called "MyWB1.xls" and
"MyWB2.xls". In MyWB1 I want cell A1 to have the same value as A1 in MyWB2
and I want cell A3 to have the same value as A2 in MyWB2. So here's the code
that is written to MyWB2 (which would be your "third" sheet).

Sub UpdateValues()
With Workbooks("MyWB1.xlsx").Worksheets(1)
.Range("A1").Value = ThisWorkbook.ActiveSheet.Range("A1").Value
.Range("A3").Value = ThisWorkbook.ActiveSheet.Range("A2").Value
End With
End Sub

Now all you do on your third sheet is insert a shape (anything you like),
right click and then "Assign Macro". You assign the above macro. Now when
someone copies this sheet, they copy the button as well. They can modify the
values and then simply click the button to do the calculation.

If this is helpful click yes.
Rick

"Ronnie" wrote:

Hi,

How can I make a cell on a worksheet always accept input from a certain cell
on any new copy of another worksheet?

In Excel 2003 I have made a workbook which I could use as a template, but I
would like to just have one book for multiple transactions, each on a newly
created sheet.

Base figures and calculations are on two sheets. One is protected with the
user allwed to modify one unlocked cell only. The other is protected with no
edits allowed. These sheets accept information from and display results on a
third sheet.

The third sheet is also protected, but the user can enter a variety of
required information in certain cells, which pass the user input back to the
two sheets containing the base calculations and formulae, and obtains the
results from them. Results are displayed in non editable cells. I intend
this sheet to be a template sheet so that using the Move or Copy context menu
the user can create and name a new sheet for a new transaction. The
information is passed about by Copy Paste Special Paste Link.

The problem is that when I make a new copy of the third woksheet, the input
is not passed back to the base sheets, as those sheets only reference the
original third sheet.

I have looked at 3d references, but a predetermined number of worksheets
must exist for that to work.

I'd be grateful for any advice on this.

Regards




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
Worksheet Names is Defined by Cell value on Sheet 1 (named Summary NeedToKnow Excel Discussion (Misc queries) 7 January 7th 09 07:44 PM
Refer to a sheet using a cell value bony_tony Excel Worksheet Functions 2 July 11th 08 04:27 PM
copying sheet references that refer to a cell in the preceding she GBT Excel Worksheet Functions 1 March 24th 06 07:51 PM
Set up a formala to refer to a cell in a different sheet Brian Excel Worksheet Functions 4 October 20th 05 11:51 PM
Refer to sheet name specified in other cell Marko Pinteric Excel Discussion (Misc queries) 2 March 4th 05 09:13 AM


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