VBA Change Active Windows active sheet

seniorjerry

New Member
Joined
Jan 20, 2023
Messages
9
Office Version
  1. 365
Platform
  1. Windows
I have a very simple macro tied to Ctrl + Shift + A which bring you to a certain sheet. However if I have multiple windows open it can act weirdly. On my laptop it changes the active window to that sheet but on my desktop it changes window 1 to that sheet and not the active window. Is their a way to only change the sheet of the active window or is their maybe a setting that I am missing that is making this inconsistency happen?

VBA Code:
Sub Summ()
    Sheets("Summary").Activate
    Sheets("Summary").Range("A1").Activate
End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
If you have multiple Workbooks open, you might need to specify the Workbook. Try this:
VBA Code:
Sub Summ()
    Workbooks("YourWorkbookName").Sheets("Summary").Activate
    Workbooks("YourWorkbookName").Sheets("Summary").Range("A1").Activate
End Sub
 
Upvote 0
If you have multiple Workbooks open, you might need to specify the Workbook. Try this:
VBA Code:
Sub Summ()
    Workbooks("YourWorkbookName").Sheets("Summary").Activate
    Workbooks("YourWorkbookName").Sheets("Summary").Range("A1").Activate
End Sub
This doesn't seem to fix it tried ThisWorkbook. & Workbooks(ActiveWorkbook.Name). and neither seemed to work for this any other ideas on this problem?
 
Upvote 0
Try using the actual name of the Workbook. i.e. - Workbooks("MyExcelFile.xlsm").Sheets("Summary").Activate
 
Upvote 1

Forum statistics

Threads
1,214,634
Messages
6,120,659
Members
448,975
Latest member
sweeberry

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