Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Registrating data on a sheet without activating it

Hello,

Simple (?) question.
How can I set a value or a text in a specific cell on a specific sheet
without activating that sheet.
For example,.....

My active sheet is sheetname "Start" and when I activate sheetname
"Sheet2" I want registrate the text "Sheet2" in cell A1 of sheetname
"Start".

I had used :

Private Sub Worksheet_Activate() ' - activatemacro on sheet2
Sheets("START").Select
Range("A1").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "Sheet2"
Sheets("Sheet2").Select
Range("A1").Select
End Sub

Problem now is that this a loop. I think (?) the solution is
registration on sheet "Start" without activating it, otherwise you
activating Sheet2 again... and again...

regards,
Johan.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Registrating data on a sheet without activating it

Yes, it's a loop. Try:

Private Sub Worksheet_Activate() ' - activatemacro on sheet2
Worksheets("START").Range("A1") = "START"
End Sub

Cheers,

Joerg Mochikun


"johan" wrote in message
ups.com...
Hello,

Simple (?) question.
How can I set a value or a text in a specific cell on a specific sheet
without activating that sheet.
For example,.....

My active sheet is sheetname "Start" and when I activate sheetname
"Sheet2" I want registrate the text "Sheet2" in cell A1 of sheetname
"Start".

I had used :

Private Sub Worksheet_Activate() ' - activatemacro on sheet2
Sheets("START").Select
Range("A1").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "Sheet2"
Sheets("Sheet2").Select
Range("A1").Select
End Sub

Problem now is that this a loop. I think (?) the solution is
registration on sheet "Start" without activating it, otherwise you
activating Sheet2 again... and again...

regards,
Johan.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Registrating data on a sheet without activating it

Sorry, did get the input text wrong, so line should read:
Worksheets("START").Range("A1") = "Sheet2"

Joerg

"Joerg" wrote in message
...
Yes, it's a loop. Try:

Private Sub Worksheet_Activate() ' - activatemacro on sheet2
Worksheets("START").Range("A1") = "START"
End Sub

Cheers,

Joerg Mochikun


"johan" wrote in message
ups.com...
Hello,

Simple (?) question.
How can I set a value or a text in a specific cell on a specific sheet
without activating that sheet.
For example,.....

My active sheet is sheetname "Start" and when I activate sheetname
"Sheet2" I want registrate the text "Sheet2" in cell A1 of sheetname
"Start".

I had used :

Private Sub Worksheet_Activate() ' - activatemacro on sheet2
Sheets("START").Select
Range("A1").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "Sheet2"
Sheets("Sheet2").Select
Range("A1").Select
End Sub

Problem now is that this a loop. I think (?) the solution is
registration on sheet "Start" without activating it, otherwise you
activating Sheet2 again... and again...

regards,
Johan.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Registrating data on a sheet without activating it

Johan,
Worksheets("Start").Range("A1").Value="Sheet2"

or possibly, depending on what you are doing:
Worksheets("Start").Range("A1").Value=ActiveSheet. Name

NickHK

"johan" wrote in message
ups.com...
Hello,

Simple (?) question.
How can I set a value or a text in a specific cell on a specific sheet
without activating that sheet.
For example,.....

My active sheet is sheetname "Start" and when I activate sheetname
"Sheet2" I want registrate the text "Sheet2" in cell A1 of sheetname
"Start".

I had used :

Private Sub Worksheet_Activate() ' - activatemacro on sheet2
Sheets("START").Select
Range("A1").Select
Selection.ClearContents
ActiveCell.FormulaR1C1 = "Sheet2"
Sheets("Sheet2").Select
Range("A1").Select
End Sub

Problem now is that this a loop. I think (?) the solution is
registration on sheet "Start" without activating it, otherwise you
activating Sheet2 again... and again...

regards,
Johan.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Registrating data on a sheet without activating it

Thanks, works fine.

Another supplemental question....

Now the last used sheet (with the above mentioned registrationmacro)
is registrated in sheet "Start" cell A1.
Question...
How to open on a different sheet, without the above mentioned
registrationmacro, the sheetname that is registrated in sheet "Start"
cell A1.

For example....
In sheet Start cell A1 last used sheetname "Sheet2" is registrated.
Now I'm in sheet 10 and with a macro I want to open the sheetname that
is registrated in sheet "Start" cell A1.

thanks a lot,
regards.... Johan




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Registrating data on a sheet without activating it

Not sure what you are doing, but something like:

Dim SheetName As String
SheetName = Worksheets("Start").Range("A1").Value
Worksheets(SheetName).Activate

NickHK

"johan" wrote in message
oups.com...
Thanks, works fine.

Another supplemental question....

Now the last used sheet (with the above mentioned registrationmacro)
is registrated in sheet "Start" cell A1.
Question...
How to open on a different sheet, without the above mentioned
registrationmacro, the sheetname that is registrated in sheet "Start"
cell A1.

For example....
In sheet Start cell A1 last used sheetname "Sheet2" is registrated.
Now I'm in sheet 10 and with a macro I want to open the sheetname that
is registrated in sheet "Start" cell A1.

thanks a lot,
regards.... Johan




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Registrating data on a sheet without activating it

I assume that you have more than just Sheet2 to put its name into A1 of
START. In this case you shouldn't use macros in each sheet. I think it would
be better to put something like

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.Name < "START" Then Worksheets("START").Range("A1") = Sh.Name
End Sub

into the code section of ThisWorkbook. This will put the sheetname of
whatever sheet is activated (except the START sheet itself) into A1 of
START. NickHK already showed you how to use the resulting text for your
code.

Cheers,

Joerg

"johan" wrote in message
oups.com...
Thanks, works fine.

Another supplemental question....

Now the last used sheet (with the above mentioned registrationmacro)
is registrated in sheet "Start" cell A1.
Question...
How to open on a different sheet, without the above mentioned
registrationmacro, the sheetname that is registrated in sheet "Start"
cell A1.

For example....
In sheet Start cell A1 last used sheetname "Sheet2" is registrated.
Now I'm in sheet 10 and with a macro I want to open the sheetname that
is registrated in sheet "Start" cell A1.

thanks a lot,
regards.... Johan




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
Activating Sheet from a List Magnivy Excel Programming 11 May 31st 06 03:20 PM
updating data w/o activating another sheet... Ark_Bouldering Excel Programming 2 February 27th 05 02:35 PM
autorun upon activating a sheet cdde[_6_] Excel Programming 0 November 10th 04 11:43 PM
autorun upon activating a sheet cdde[_5_] Excel Programming 1 November 10th 04 07:34 PM
Problem activating a sheet jowatkins[_6_] Excel Programming 1 January 19th 04 01:33 PM


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

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

About Us

"It's about Microsoft Excel"