VBA activate sheets in separate windows

McGuilliam

New Member
Joined
Oct 23, 2020
Messages
25
Office Version
  1. 365
Platform
  1. Windows
I have an excel file which is always open in two windows, each window showing a different worksheet of the same workbook. I use a VBA-macro to move some data around. In the end I want my two windows to show the same sheets again, but my code for this seems to be flawed. Could someone help me on this?
Currently I tried this:

VBA Code:
Windows(1).Worksheets("Metingen").Activate
 Windows(2).Worksheets("Pivot table").Activate
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Something like this;
VBA Code:
Dim i As Long
For i = 1 To 2
    ThisWorkbook.Windows(i).Activate
    Sheets("Metingen").Select
Next i
 
Upvote 0

Forum statistics

Threads
1,215,079
Messages
6,122,998
Members
449,092
Latest member
masterms

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