ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run a sheet's activate code when entering it's workbook (https://www.excelbanter.com/excel-programming/347208-run-sheets-activate-code-when-entering-its-workbook.html)

mikeburg[_54_]

Run a sheet's activate code when entering it's workbook
 

I have sheet activate code for every worksheet in a workbook.

I have auto_open code that selects the sheet named data.

The proplem is if the sheet named data was active when I exited the
workbook, the sheet active code for data will not execute when opening
the workbook. I have click another sheet then click back into the sheet
named data to get the code to execute.

Any ideas would be greatly appreciated. mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=490371


Gary Keramidas

Run a sheet's activate code when entering it's workbook
 
did you try the code on the thisworkbook code page
Private Sub Workbook_Open()
--


Gary


"mikeburg" wrote in
message ...

I have sheet activate code for every worksheet in a workbook.

I have auto_open code that selects the sheet named data.

The proplem is if the sheet named data was active when I exited the
workbook, the sheet active code for data will not execute when opening
the workbook. I have click another sheet then click back into the sheet
named data to get the code to execute.

Any ideas would be greatly appreciated. mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile:
http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=490371




Dave Peterson

Run a sheet's activate code when entering it's workbook
 
Maybe just select a different sheet, then select the sheet you want in your
workbook_open event.

Or just call the worksheet_activate event from the workbook_open event:

Option Explicit
Private Sub Workbook_Open()
Call Sheet2.Worksheet_Activate
End Sub

Use the codename (I used sheet2).

And remove Private from the
Private Sub Worksheet_Activate()
line.

mikeburg wrote:

I have sheet activate code for every worksheet in a workbook.

I have auto_open code that selects the sheet named data.

The proplem is if the sheet named data was active when I exited the
workbook, the sheet active code for data will not execute when opening
the workbook. I have click another sheet then click back into the sheet
named data to get the code to execute.

Any ideas would be greatly appreciated. mikeburg

--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=490371


--

Dave Peterson


All times are GMT +1. The time now is 01:09 AM.

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