Link to home
Start Free TrialLog in
Avatar of biker9
biker9Flag for Canada

asked on

Excel 2013 vba multiple monitor configuration, close all windows except a specific one

Hello experts,

I have a multiple monitor setup, and trying to close all windows except a specific one.
So assuming the sheets open are in:
Windows("Monitors.xlsm:1")
Windows("Monitors.xlsm:2")
Windows("Monitors.xlsm:3")

How do I replace the “Monitors.xlsm” with the current file name?
Make Windows("CurrentfileName.xlsm:1") the active window?
and then close Windows 2 & 3?

Thanks,
biker9
Avatar of Saurabh Singh Teotia
Saurabh Singh Teotia
Flag of India image

You can use the following code..This will close all the workbooks..leaving the workbook open from which you are running this code..please change it basis of your requirement..

Also the workbooks it's closing it will save changes in them..

    Dim wb As Workbook

    For Each wb In Workbooks

        If wb.Name <> ThisWorkbook.Name Then wb.Close (True)


    Next wb

Open in new window


Saurabh...
Avatar of biker9

ASKER

Sorry, that's not it, I am referring to closing open windows within the workbook, not closing the workbook itself.
ASKER CERTIFIED SOLUTION
Avatar of Saurabh Singh Teotia
Saurabh Singh Teotia
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of biker9

ASKER

Thank you, works perfectly!