Hiding an Excel worksheet with VBA

后端 未结 5 997
再見小時候
再見小時候 2020-12-05 17:33

I have an Excel spreadsheet with three sheets. One of the sheets contains formulas for one of the other sheets.

Is there a programmatic way to hide the sheet which c

5条回答
  •  生来不讨喜
    2020-12-05 18:09

    You can do this programmatically using a VBA macro. You can make the sheet hidden or very hidden:

    Sub HideSheet()
    
        Dim sheet As Worksheet
    
        Set sheet = ActiveSheet
    
        ' this hides the sheet but users will be able 
        ' to unhide it using the Excel UI
        sheet.Visible = xlSheetHidden
    
        ' this hides the sheet so that it can only be made visible using VBA
        sheet.Visible = xlSheetVeryHidden
    
    End Sub
    

提交回复
热议问题