VBA to UnHide window

EssKayKay

Board Regular
Joined
Jan 5, 2003
Messages
233
Office Version
  1. 2007
Platform
  1. Windows
As example, I have a worksheet named TryMe1 with Sheet1 named “Amortize”. I have a couple routines that hide and unhide Amoritze. The “Hide” works fine. However, if the name of the file is changed (i.e. TryMe1 to TryMe2), the “Unhide” does not work as the name is hardcoded. Is there a way to “unhide” a window no matter what the name of the file is?

VBA to Hide – ActiveWindow.Visible = False
VBA to UnHide – Windows("tryme1.xls").Visible = True

Thanks,
Steve K.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
This could be one way:

VBA Code:
Sub unhide_wb()
  Dim wb As Workbook
  
  For Each wb In Workbooks
    If Windows(wb.Name).Visible = False Then
      Windows(wb.Name).Visible = True
    End If
  Next
End Sub

:cool:
 
Upvote 0
Solution
This could be one way:

VBA Code:
Sub unhide_wb()
  Dim wb As Workbook
 
  For Each wb In Workbooks
    If Windows(wb.Name).Visible = False Then
      Windows(wb.Name).Visible = True
    End If
  Next
End Sub

:cool:
Excellent - works great. Thank you very much Dante
 
Upvote 0

Forum statistics

Threads
1,215,107
Messages
6,123,127
Members
449,097
Latest member
mlckr

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