VBA - Colour Cell on Locked Worksheet!!

  • Thread starter Thread starter Jado
  • Start date Start date
J

Jado

Hi

Is it possible to fill a cell with colour on a locked worksheet??

I guess not!

what I would like to do is have a peace of code that runs after the user
selects a colour from the colour palette toolbox, then temporarily unlock
the sheet, fill the selection with colour, then re-lock.

is they any functionality accessible in the colour toolbox? like an after
update event?

or can anyone think of a workaround.

Thanks

Jado
 
Hi
depending on your Excel version you can allow formating cells within
the Protection dialog. Which version do you use?
 
How about letting them select a range (you could check to make sure it's ok with
you in code), then show the dialog, then fill the cells.

Option Explicit
Sub testme()

Dim myRng As Range

With ActiveSheet
'a specific cell
Set myRng = .Range("a1")
'for just the first cell in the selection
Set myRng = Selection(1)
'for all the selected cells
Set myRng = Selection

.Unprotect Password:="hi"
Application.Dialogs(xlDialogPatterns).Show
.Protect Password:="hi"

End With

End Sub
 
Back
Top