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:
After this, my code closes the workbook (myWB) and then I activate the workbook with the code by:
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.
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.