Activate a sheet without using "Activate"

mcomp72

Active Member
Joined
Aug 14, 2016
Messages
308
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I have read that it is best not to use .Activate whenever possible. But I can't figure out how to do something without it.

In my workbook, one thing it will do is copy sheets into a new workbook. Once it copies the sheets, I want the code to select the first workbook in the sheet, so that when the user opens that workbook later, the first one will be the one it opens on. I can do that with this code:

Code:
myWB.Sheets(1).Activate

After this, my code closes the workbook (myWB) and then I activate the workbook with the code by:

Code:
ThisWorkbook.Activate

Is there a way to do the same thing without using .Activate?

Another reason that I want to avoid it is that even though I have ScreenUpdating set to False, when the Activate lines execute, I see the screen flash for a second.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Code:
Application.Goto myWB.Sheets(1).Cells(1, 1)

But you will still get some screen flash.
 
Upvote 0
Thanks. Is there no way to avoid the screen flash? I don't understand what is causing it.
 
Upvote 0
Thanks. Is there no way to avoid the screen flash? I don't understand what is causing it.
Don't notice any flash when activating one sheet. You could try activating that sheet when you open the workbook with a workbook_open event like this:
Code:
Private Sub Workbook_Open()
Sheets(1).Activate
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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