QUESTION: is there a way to hide/disabled tabs from the advance options ribbons?  i have tried to disable the right click function on the tab to prevent the moving/copying/deleting worksheets.. in 2010 version you could protect workbook by unchecking structure and checking windows, thus allowing macros.  but in 2016 version you can protect workbook but the only selection available is structure and if you check structure it protects workbook but disables macros....

I have tried the following code

   Application.CommandBars("Ply").Enabled = False

but this code effects all excel workbooks, new or current, whether this is opened or not and i have to use the following code

   Application.CommandBars("Ply").Enabled = True

to allow ....which wont work if i email the work to users, or they open them on different PC....

.and cant seem to get an answer which would solve my issue, so thinking the next best thing would be to disable and NOT allow users to open tabs or show tabs in the advance options???

ANSWER: Checking structure in the protect workbook does not disable macros. In File/Options, Advanced section, just about 50% of the way down is a checkbox to Show Sheet Tabs. Unchecking this will hide the tabs. But I do think the best way is protect the workbook structure.

---------- FOLLOW-UP ----------

QUESTION: i get a run time error

unable to set the visible property of the worksheet class

all i have done is create a macro to switch pages, thats it and click on protect workbook and leave the structure box checked..

then this error?

are u sure or am i doing something wrong?


ANSWER: I'd have to see the VBA Code.
If you're making sheets visible/hidden, you have to unprotect the workbook first (in code)

---------- FOLLOW-UP ----------

QUESTION: i can send you the workbook but here is the simple code with two sheets

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cancel = True

If Target.Count > 1 Then Exit Sub

Select Case Target.Address(0, 0)


Case "A1"

   Application.ScreenUpdating = False

   Sheets("sheet2").Visible = True
   Worksheets("sheet1").Visible = xlSheetVeryHidden

   Application.ScreenUpdating = True

End Select
End Sub

then i go to protect workbook and leave the structure checked.....and get that error

Change this
  Sheets("sheet2").Visible = True
   Worksheets("sheet1").Visible = xlSheetVeryHidden

to this
  Sheets("sheet2").Visible = True
   Worksheets("sheet1").Visible = xlSheetVeryHidden
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Bob Umlas


I`m a Microsoft Excel MVP (Most Valuable Professional) and have been since the inception of the program in 1995. I can answer every kind of Excel question except: API, Importing/exporting to other programs (powerpoint, word,...) Also check out my in-person training link at http://www.thumbtack.com/ny/new-york/excel-training/


Worked with MS Excel since version 0.99 (on the Mac!). Was contributing editor to Excellence Magazine, having written >300 articles. John Walkenbach said of me "I finally met someone who knows as much about Excel as I do."

Excellence, The Expert, Microsoft

BA in math, Hofstra University, 1965

Awards and Honors
Led sessions for the Convergence 2004-2006 seminar on Excel tips & tricks

©2016 About.com. All rights reserved.