Sheet Protection

D

Damian

I wrote a Micro to change something is Data>Validation window with a shortcut
key ctrl-F. When I protect the sheet I am unable to use that micro.
I even tried allowing all the functions that are listed in protection window
and still nothing.

Is there a way to get pass that? Or is Data>Validation just LOCKED when you
protect the sheet.

Thanks
 
G

Gord Dibben

A lot of functions cannot be changed on a protected sheet.

Usually you provide code to unprotect, do what you want then re-protect.

ActiveSheet.Unprotect Password:="justme"
do things
ActiveSheet.Protect Password:="justme"

Post the macro code that you wrote to change something in Data>Validation.


Gord Dibben MS Excel MVP
 
D

Damian

OK here is my Code:

Sub CustomCell()
'
' CustomCell Macro
' Macro recorded 8/4/2009 by IT Department
'
' Keyboard Shortcut: Ctrl+f
'
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop,
Operator _
:=xlBetween
.IgnoreBlank = False
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub

Basically it clears the drop down cell so custom data can be entered rather
then picked from drop down menu.

So when I put your command in it will work?
Thanks
 
G

Gord Dibben

Sub CustomCell()
'
' CustomCell Macro
' Macro recorded 8/4/2009 by IT Department
'
' Keyboard Shortcut: Ctrl+f

'
ActiveSheet.Unprotect Password:="justme"
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, _
AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = False
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
With ActiveSheet
.Protect Password:="justme"
.EnableSelection = xlNoRestrictions
End With
End Sub


Gord
 
D

Damian

Works Like a charm. Thank you.

One last thing.
I want the user to only select unlocked cells and not locked cells.
How do I wright that for the restrictions?

In the Protect Sheet window under:
Allow all users of this worksheet to: (the only thing checked is:)
Select unlocked cells

Thank you in advance
 
G

Gord Dibben

Replace the other line with.............

..EnableSelection = xlUnlockedCells


Gord
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top