ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sheet_activate event (to another Sheet and back again.....) (https://www.excelbanter.com/excel-programming/278296-sheet_activate-event-another-sheet-back-again.html)

zSplash

Sheet_activate event (to another Sheet and back again.....)
 
I want some code to run whenever Sheet8 is activated, so am running the code
(which is "stored" in ThisWorkbook) on the sheet.activate event.

The code essentially is a counter function, going to Sheet3, getting values
for 3 counters, and then going back to Sheet8 to enter the value for the
counters. I get an run-time error '1004" at this place in the code:

ActiveWorkbook.Worksheets(8).Select
Range("B" & (47 + Y)).Select
ActiveCell.Value = counterH

I surmise I'm mis-identifying Sheet8, but this is exactly how I identified
Sheet3, when I went there. I cannot get the code to continue. Any
suggestions, guys?

TIA



Ed[_9_]

Sheet_activate event (to another Sheet and back again.....)
 
If the name of your worksheet is Sheet8, I would use
ActiveWorkbook.Worksheets("Sheet8").Select

Ed

"zSplash" <zNOSPAMSplash@ gci.net wrote in message
...
I want some code to run whenever Sheet8 is activated, so am running the

code
(which is "stored" in ThisWorkbook) on the sheet.activate event.

The code essentially is a counter function, going to Sheet3, getting

values
for 3 counters, and then going back to Sheet8 to enter the value for the
counters. I get an run-time error '1004" at this place in the code:

ActiveWorkbook.Worksheets(8).Select
Range("B" & (47 + Y)).Select
ActiveCell.Value = counterH

I surmise I'm mis-identifying Sheet8, but this is exactly how I identified
Sheet3, when I went there. I cannot get the code to continue. Any
suggestions, guys?

TIA





zSplash

Sheet_activate event (to another Sheet and back again.....)
 
Thank you, Ed. For some reason, that worked. Appreciate it.

st.

"Ed" wrote in message
...
If the name of your worksheet is Sheet8, I would use
ActiveWorkbook.Worksheets("Sheet8").Select

Ed

"zSplash" <zNOSPAMSplash@ gci.net wrote in message
...
I want some code to run whenever Sheet8 is activated, so am running the

code
(which is "stored" in ThisWorkbook) on the sheet.activate event.

The code essentially is a counter function, going to Sheet3, getting

values
for 3 counters, and then going back to Sheet8 to enter the value for the
counters. I get an run-time error '1004" at this place in the code:

ActiveWorkbook.Worksheets(8).Select
Range("B" & (47 + Y)).Select
ActiveCell.Value = counterH

I surmise I'm mis-identifying Sheet8, but this is exactly how I

identified
Sheet3, when I went there. I cannot get the code to continue. Any
suggestions, guys?

TIA








All times are GMT +1. The time now is 06:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com