Colour fill within a range

  • Thread starter Thread starter Paul Watkins
  • Start date Start date
P

Paul Watkins

Hi
I have a spreadsheet that i want people to be able to colour cells in using
a macro
I also only want them to colour specific cells. A3 to Z25
The sheet is protected ,and to enable them to colour cells i have a macro
which first unprotects- colours the active cell - reprotects.
is there any way that i can prevent people from colouring cells that they
are not supposed to.(e.g A1)

I Only want people to colour cells between Column A Row 3 and Column Z row
25.
This is the macro:

Sub Macro1()
On Error Resume Next

ThisWorkbook.Worksheets("paint").Unprotect
ThisWorkbook.Worksheets("paint").Select
Selection.Font.ColorIndex = 0
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
ThisWorkbook.Worksheets("paint").Protect
End Sub


Thanks in advance
Paul
 
Hi Paul

Try this

Sub Macro1()
If ActiveSheet.Name <> "paint" Then Exit Sub
If Selection.Cells.Count <> 1 Then Exit Sub
If Not Application.Intersect(Range("A3:Z25"), Selection) Is Nothing Then
With Worksheets("paint")
.Unprotect
.Selection.Font.ColorIndex = 0
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
.Protect
End With
End If
End Sub
 
Back
Top