W
willjohnson33
I am trying to figure out a way to close all duplicate windows of
workbooks using VBA
I thought this would work but it doesn't.
For Each wb In Workbooks
If Windows.Count > 1 Then
For i = 1 To Windows.Count
Windows(2).Close
Next i
End If
Next wb
For example: I have 3 workbooks wb1, wb2, wb3 and with wb3 I have 2
windows open so there are acutally 4 windows total. wb1, wb2, wb3:1,
wb3:2
I only want to close wb3:2. And would prefer to do it without having
to actually activate each workbook.
Any help is greatly appreciated.
workbooks using VBA
I thought this would work but it doesn't.
For Each wb In Workbooks
If Windows.Count > 1 Then
For i = 1 To Windows.Count
Windows(2).Close
Next i
End If
Next wb
For example: I have 3 workbooks wb1, wb2, wb3 and with wb3 I have 2
windows open so there are acutally 4 windows total. wb1, wb2, wb3:1,
wb3:2
I only want to close wb3:2. And would prefer to do it without having
to actually activate each workbook.
Any help is greatly appreciated.