Highlighting cells after protecting sheet

WarriorJ

New Member
Joined
Jan 6, 2014
Messages
9
I have created some buttons in my excel sheet to highlight cells when clicked. However, I also want to protect the document so that only certain cells can be modified. When I protect the document the buttons no longer work even though the specified cells aren't locked. I'm sure it is just some simple setting that I don't know about.

Here is the code for the highlighting button:

Sub highlightgreen()
'
' highlightgreen Macro
' highlights the current cell in green to denote passage through x-ray
'
' Keyboard Shortcut: Ctrl+g
'
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 5296274
.TintAndShade = 0
.PatternTintAndShade = 0
End With

Selection.Offset(1, 0).Select
End Sub
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Alright,

I'm a dummy. I just corrected by entering code to unprotect and re-protect before and after the highlighting function. May not be the "proper" way to do it but it seems to work. Still up for learning if anyone has a better solution.

Thanks!
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,693
Members
449,048
Latest member
81jamesacct

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
Back
Top