ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Enabling a menu item (https://www.excelbanter.com/excel-programming/303421-enabling-menu-item.html)

MoonWeazel[_2_]

Enabling a menu item
 
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

--
Message posted from http://www.ExcelForum.com


Nigel

Enabling a menu item
 
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

"MoonWeazel " wrote in message
...
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 worries
doing that bit!

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

If the formulas are hidden then the macro behind the button fails
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) to
enable the sort option on the sheet and then disable it again (after
the search).

Is this possible?

TIA,

MoonWeazel


---
Message posted from http://www.ExcelForum.com/




Masked Coder[_3_]

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

your code

ActiveSheet.Protect (your password here

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 05:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com