excel - Protect a sheet from opening within a workbook -


i have excel workbook multiple sheets. there way password protect users opening sheet within workbook? sheet has large graph on don't want able see, let alone edit.

thanks in advance help

edit

i used following code allow users click formcontrol button access sheet in question.

sub showheatmap()  dim s string  s = inputbox("enter password")  if s = vbnullstring      exit sub  elseif s <> "wiretransfer"      exit sub  else      worksheets("training heat map").visible = xlsheetvisible  end if end sub 

this associated button on kind of "homepage" sheet added workbook.

but can't sheet remain hidden when open workbook again. tried code:

private sub workbook_beforeclose(cancel boolean)  thisworkbook.worksheets("training heat map").visible = xlsheetveryhidden end sub 

any ideas? code inputted on module sheet under general declarations

via this answer, think might trick you. within vba, put within thisworkbook:

private sub workbook_sheetactivate(byval sh object) dim mysheets string, response string mysheet = "sheet1" if activesheet.name = mysheet activesheet.visible = false     response = inputbox("enter password view sheet")         if response = "mypass"             sheets(mysheet).visible = true             application.enableevents = false             sheets(mysheet).select             application.enableevents = true         end if end if sheets(mysheet).visible = true end sub 

obviously require bit of tailoring needs. remember need password protect vba code, otherwise able view , find out password.


Comments