VBA - Colour Cell on Locked Worksheet!!

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
 
F

Frank Kabel

Hi
depending on your Excel version you can allow formating cells within
the Protection dialog. Which version do you use?
 
D

Dave Peterson

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
 

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