Hi Everyone
I am using a button on a worksheet to excecute the following code:
It works perfectly when the sheet is unprotected but not when it is protected. the rows are not locked and neither is the button.Private Sub HideExamples() If Rows("6:7").EntireRow.Hidden = False Then Rows("6:7").EntireRow.Hidden = True Sheet2.Shapes("Button 15").TextFrame.Characters.Text = ("View Examples") Else Rows("6:7").EntireRow.Hidden = False Sheet2.Shapes("Button 15").TextFrame.Characters.Text = ("Hide Examples") End If End Sub
Any ideas whats going on??
Hi twofootgiant,
Add the line of code below:
and then after all of the code is complete put this at the endSheets("Sheet Name").Unprotect
(If sheet is passworded then use)Sheets("Sheet Name").Protect
Sheets("Sheet Name").Unprotect "Password HERE" Sheets("Sheet Name").Protect "Password HERE"
There are only 10 types of people in the world:
Those who understand binary, and those who don't!
The best way is to use Worksheet Protection with UserInterFace Only, see the details & example workbook here
http://www.excel-it.com/vba_examples.htm
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
genius...thankyou :D
Hope you was calling me a geniuslol, prob royUK
.
no probs![]()
There are only 10 types of people in the world:
Those who understand binary, and those who don't!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks