Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

hide sheet

  Asked By: Laaibah    Date: Nov 14    Category: MS Office    Views: 769
  

I have a workbook with sheets that I don't want anyone to see. I can
hide them with the spreadsheet format command, but then my vba code
can't access them. Does anyone know how to unhide (and later rehide)
from within the vba code? Thanks very much.

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Noah Evans     Answered On: Nov 14

You can use following VBA code:
You can change the "mysheet" with you sheet  name. It will unhide  the sheet if
it is hideen.


Sub myload()
Dim mkc1 As Error
Dim sheet1 As String
sheet1 = "mysheet"

For Each ws In Worksheets
If ws.Name = sheet1 Then
edits = 1
End If


Next ws

if edits = 0 Then
Else
If Application.Worksheets(sheet1).Visible = True Then
Else
Application.Worksheets(sheet1).Visible = True
End If
End If
End Sub

I hope it works

 
Answer #2    Answered By: Candace Foster     Answered On: Nov 14

You can modify the following code  to do what you want:
' This makes all sheets  visible (ie for calculations to be done)
Sub all_visible()

For Each Sh In Sheets
Sh.Visible = True
Next Sh

End Sub

'This makes the following sheets invisible

Sub invisible1()

Worksheets("Instructions").Visible = False
Worksheets("Rankings").Visible = False

End Sub

 
Answer #3    Answered By: Jo Fowler     Answered On: Nov 14

Thanks for the help. I looked for Hide, but didn't think to look for
Visible. (I am happy to take your admonition to heart, but I think
maybe it makes more sense to ignore the questions that you find
offensively easy.)

 
Didn't find what you were looking for? Find more on hide sheet Or get search suggestion and latest updates.




Tagged: