Solved using vba close a ws and go to open ws

June 24, 2013 at 12:15:29
Specs: Windows 7
Hi Guys,
Been struggling for a while with this one.

Sub hidesheet()
'
' hidesheet
'
    ActiveWindow.SelectedSheets.Visible = False
    Sheets("DASHBOARD").Select
End Sub

The above Vba works just fine to close the worksheet that I am in from a command button, but what I need is from a particular worksheet, lets call it 'WINE', is to close and return to one of two worksheets that may be open, "DASBOARD" or "VINO"

Any ideas as I am completely stumped on this.

Just an extra, either one or the other will be open, but neither at the same time


See More: using vba close a ws and go to open ws

Report •


#1
June 24, 2013 at 12:44:22
✔ Best Answer
Assuming what you say is true - that only Dasboard or Vino will be visible at any given time - this should get you what you want.


Sub hidesheet()
'
' hidesheet
'
    ActiveWindow.SelectedSheets.Visible = False
      If Sheets("Dasboard").Visible = True Then
         Sheets("Dasboard").Select
      Else: Sheets("Vino").Select
      End If
End Sub

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

#2
June 24, 2013 at 13:30:29
Thanks for the quick response, very easy code when you know how. However I have a problem where the worksheet that this applies to is now password protected and I cnat get the thing unlocked. tried a number of formats but nothing works

Anything about that I can use, and this solely for one sheet out of 50 odd on the little program I've been working on


Report •

#3
June 24, 2013 at 14:31:37
Sorted the locked sheet and the little Vba works wonders, Thankyou

Report •
Related Solutions


Ask Question