Enabling a menu item

M

MoonWeazel

Hallo Forum,

I am hoping someone out there will be able to help me!

I have a spreadsheet which needs to have hidden formula. No worrie
doing that bit!

On the sheet there is some data which the user can sort using
button.

If the formulas are hidden then the macro behind the button fail
because the sheet is protected and the sort option disabled.

I would like to add a bit of code to the button (before the sort) t
enable the sort option on the sheet and then disable it again (afte
the search).

Is this possible?

TIA,

MoonWeaze
 
N

Nigel

Use the following to unprotect the sheet, then re-protect after the sort.
The password is optional, change it to whatever of pass it as a string from
your password procedure if you need one.

ActiveSheet.Unprotect ("xxxxxx")

' put your sort in here

ActiveSheet.Protect Password:="xxxxxx", DrawingObjects:=True,
Contents:=True, Scenarios:=True


Cheers
Nigel
 
M

Masked Coder

You could put in at the beginning of the macro:
ActiveSheet.UnProtect (your password here)

your code

ActiveSheet.Protect (your password here
 
Top