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

still learning

Well-known Member
Joined
Jan 15, 2010
Messages
821
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

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,223,718
Messages
6,174,077
Members
452,542
Latest member
Bricklin

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