Extra Security on worksheets

pocquet

Board Regular
Joined
Aug 21, 2013
Messages
118
Hi Guys,

I have a security method that evaluates as as Boolean.

I use this to disable buttons so the user cant press them however I also want to disable the ability to move from the front page worksheet unless the Boolean evaluates as true.

I was hoping that I could just Enable or Disable the worksheets (the same way that you can deactivate command buttons etc) but this dosnt seem to be possible.

The only thing i can think of is to "very hide" them unless it evaluates as true. Is there a better way to stop the use of the whole workbook unless true?

TIA

Jon
 

Some videos you may like

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Robertvk

Board Regular
Joined
Oct 15, 2015
Messages
121
You could try it with a worksheet activate code.

If the Boolean = true then return to the default sheet. This solution might give you issues at a later point in time where you do want to use the sheet. You could circumvent triggering the code with Application.EnableEvents = false.

Code:
Private Sub Worksheet_Activate()

Dim bool As Boolean

If bool = True Then ActiveWorkbook.Worksheets("Sheet1").Activate

End Sub

I would suggest informing the user as to why he/she can't use the worksheet (yet).
 
Last edited:

pocquet

Board Regular
Joined
Aug 21, 2013
Messages
118
Ah ok,

So this would essentially keep pinging the user back to sheet1.

Thats not a bad solution and I can disable it manually if needed while developing (which was my reservation about the very hidden)

Naturally I would add a message box.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,521
Messages
5,596,650
Members
414,083
Latest member
Mrsash

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top