ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Open and hide a document by toggling (https://www.excelbanter.com/excel-discussion-misc-queries/141770-open-hide-document-toggling.html)

susan

Open and hide a document by toggling
 
I use an Index file all the time. It is loaded but hidden whenever Excel is
on. When I click a button it comes on but I have to physically hide it when
it is not wanted. How can the codes be changed so that the same button
caries out both the tasks by toggling?
Thank you if you can help.

Susan



Barb Reinhardt

Open and hide a document by toggling
 
Try something like this:

If Not Windows("Book1").Visible Then
Windows("Book1").Visible = True
Else
Windows("Book1").Visible = False
End If

HTH,
Barb Reinhardt

"susan" wrote:

I use an Index file all the time. It is loaded but hidden whenever Excel is
on. When I click a button it comes on but I have to physically hide it when
it is not wanted. How can the codes be changed so that the same button
caries out both the tasks by toggling?
Thank you if you can help.

Susan




susan

Open and hide a document by toggling
 
Marvellous, it works. Thanks Barb.

"Barb Reinhardt" wrote in message
...
Try something like this:

If Not Windows("Book1").Visible Then
Windows("Book1").Visible = True
Else
Windows("Book1").Visible = False
End If

HTH,
Barb Reinhardt

"susan" wrote:

I use an Index file all the time. It is loaded but hidden whenever Excel
is
on. When I click a button it comes on but I have to physically hide it
when
it is not wanted. How can the codes be changed so that the same button
caries out both the tasks by toggling?
Thank you if you can help.

Susan







All times are GMT +1. The time now is 03:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com