You are here:

Excel/Your VBA tab password solution - tweak needed!


Mr. Umlas, your solution is wonderful, I am just in need of a single tweak to make this completely useful and efficient for all users.

Is there a way to set *two* acceptable passwords for each tab, rather than just one?  We have a file here that is collaborative for multiple sales regions/managers, and your solution is perfect; what I need is to be able to add a second password that would be uniform through *all* tabs that I can use, that I can give to our CEO so he and I can see all tabs by remembering just one unique password, rather than several different ones - does that make sense?

Also, is there a way to tweak the code such that a user only has to enter their password once after opening the file (each time it's opened), rather than every time they return to their tab?  We have some tabs that are not restricted from view that show the company-wide figures and impact of changes each user makes that we want them to be able to see, but not necessarily have to enter their password when they flip back and forth between that tab and their own.

Thanks very much!

You can set a variable, like PWOK (password Okay) which is requested on file open ... something like:
Sub Auto_Open()
  pw=Inputbox("Please enter password")
  if pw="AllTabs" or pw="SomeTabs" then PWOK=true else PWOK=False
End Sub

both pw and PWOK being Public variables, and in the workbook_SheetActivate event you can check either/both...

does that help?
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


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 All rights reserved.