Having problems with Private Sub Workbook_open() and Private Sub Workbook_activate()

still learning

Well-known Member
Joined
Jan 15, 2010
Messages
826
Office Version
  1. 365
Platform
  1. Windows
I can’t seem to get this to work.
When I open the workbook, I want to open sheet1. I have 7 sheets and I don’t always go back to sheet 1 before I save and close
When I open the work book, it goes to sheet1 but the sub “movebox” doesn’t run
If I open another sheet in the workbook, and go back to sheet1, it runs
I tried to change “Open” and “Activate”
Here is what I’m trying to use:
This is in the “Thisworkbook”
VBA Code:
Private Sub Workbook_open()
Sheets("sheet1").Select
End Sub
This is Sheet1
VBA Code:
Private Sub Worksheet_activate()
movebox
opening
End Sub

mike
 
Thank you
It works.
This saves me from having an icon on the ribbon to go to sheet2 and save and close.

I thought about that when you showed me that it works if it's saved in a different worksheet.

Thanks again and i appreciate the help

Thanks for trying rabsofty

mike
 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,224,827
Messages
6,181,197
Members
453,022
Latest member
RobertV1609

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top