Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 114
Default Selected Sheet will update cell.

Dear All,

I need help to write a code that can do this:

Sheet 1
Sheet 2
Sheet 3 - Central

IF sheet 1 is selected, then Sheet 3!A1 will equal to Sheet1!G1.
IF sheet 2 is selected, then Sheet 3!A1 will change and equal to Sheet2! H1.

.... and the process will continue, sheet 1 or sheet 2.

Thanks.


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Selected Sheet will update cell.

On Sheet3, let us use cell A2 as the reference. A2 will be set to either
Sheet1 or Sheet2 via typing or data validation.


Then in A1:
=IF(A2="Sheet1",Sheet1!G1,Sheet2!H1)
--
Gary''s Student - gsnu200755
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 114
Default Selected Sheet will update cell.

Dear Gary's Student,

That won't work, too manual I guess.
A VBA code will be much better.

Sheet 3 will be hidden and the other 2 sheets will be visible. Thus when I
select either page 1 or page 2, sheet 3 (designated cells) will change
according to the sheet selected.

I have tried recording using the macro recorder, but somehow it is not that
ideal.

Please help!!! Thanks.

"Gary''s Student" wrote:

On Sheet3, let us use cell A2 as the reference. A2 will be set to either
Sheet1 or Sheet2 via typing or data validation.


Then in A1:
=IF(A2="Sheet1",Sheet1!G1,Sheet2!H1)
--
Gary''s Student - gsnu200755

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 114
Default Selected Sheet will update cell.

This is the code for sheet 1, the code for sheet 2 is similar with a little
adjustment.

Sub Sch1()
On Error Resume Next
Sheets("Sch-1").Visible = True
Sheets("Sch-1").Activate
Sheets("SCH-Ctrl").Visible = True
Sheets("SCH-Ctrl").Activate
Range("A1").Select
ActiveCell.FormulaR1C1 = "='Sch-1'!RC[6]"
Sheets("SCH-Ctrl").Visible = False
Sheets("Sch-1").Activate
Range("G1").Activate


Sheets("Key In").Visible = False
Sheets("Sch-2").Visible = FALSE

End Sub


I don't wanna use this but instead, both sheet 1 & 2 is visible, ready to be
selected and SCH-Ctrl (sheet 3) will change according to the selection or
either sheet 1 or sheet 2.

Thanks!!

" wrote:

Dear Gary's Student,

That won't work, too manual I guess.
A VBA code will be much better.

Sheet 3 will be hidden and the other 2 sheets will be visible. Thus when I
select either page 1 or page 2, sheet 3 (designated cells) will change
according to the sheet selected.

I have tried recording using the macro recorder, but somehow it is not that
ideal.

Please help!!! Thanks.

"Gary''s Student" wrote:

On Sheet3, let us use cell A2 as the reference. A2 will be set to either
Sheet1 or Sheet2 via typing or data validation.


Then in A1:
=IF(A2="Sheet1",Sheet1!G1,Sheet2!H1)
--
Gary''s Student - gsnu200755

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
Can I sort Excel sheet by the color of the fill in selected cell hg Excel Worksheet Functions 1 March 14th 06 02:37 AM
Specific cell selected when sheet opens...how??? Ron M. Excel Discussion (Misc queries) 3 February 17th 06 02:37 AM
print only selected cell contents without loosing spread sheet for Anna Tozier Excel Discussion (Misc queries) 1 September 16th 05 05:22 PM
how do i make it so that when a sheat is selected either via link or tab, that xlLastCell is selected. the last on the sheet. Daniel Excel Worksheet Functions 1 July 12th 05 01:30 AM
Update forumla in same cell on each sheet Ellen Excel Discussion (Misc queries) 2 April 15th 05 04:38 PM


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

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"