View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Tami Tami is offline
external usenet poster
 
Posts: 123
Default macro to disallow shading in certain columns

i have a spreadsheet that is protected so i have a macro to allow users to
shade or unshade cells. The macro basically says if the cell is no-color,
shade green, if its already green shade it no-color, if its any other color
already, then don't allow to shade over.

now they use it to shade anything they can so i need to limit it to select
columns.
for simplicity, say my spreadsheet is A:Z, they are allowed to shade in
columns F, k, P-T and X-Z. can some one advise me on how to modify my macro?
thanks, Tami


With Selection.Interior
If .ColorIndex = 35 Then
.ColorIndex = xlNone
Else
If .ColorIndex = xlNone Then
.ColorIndex = 35
Else
MsgBox ("Error: One or more of the cells you highlighted cannot
be shaded.")
End If
End If
End With

End Sub