Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unlock cells based on colour
Hi
I have input cells coloured blue and I want to unlock these cells. I know I need to use Colorindex, but I can't work out how to put it all together. Many thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unlock cells based on colour
Here's a procedure that will change your 'Blue' cells to unprotected.
HOWEVER, you need to decide which blue you want to unprotect. I've also attached a UDF [ColorOfCell] that will tell you the # associated with the BLUE you want. Change the 'BlueColor' variable in the procedure to that #. '/============================/ Public Sub MakeBlueCellsUnProtected() Dim BlueColor As Long Dim rngCell As Range BlueColor = 16711680 'YOUR color Blue For Each rngCell In Application.ActiveSheet.UsedRange If rngCell.Interior.Color = BlueColor Then rngCell.Locked = False End If Next rngCell End Sub '/============================/ Function ColorOfCell(Select_Cell As Range) 'Color of Background in a cell 'Full numberic equivalent of color Application.Volatile True ColorOfCell = Select_Cell.Interior.Color End Function '/============================/ -- Hope this helps. If it does, please click the Yes button. Thanks in advance for your feedback. Gary Brown "violasrbest" wrote: Hi I have input cells coloured blue and I want to unlock these cells. I know I need to use Colorindex, but I can't work out how to put it all together. Many thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unlock cells based on colour
Thanks Gary, great help
"Gary Brown" wrote: Here's a procedure that will change your 'Blue' cells to unprotected. HOWEVER, you need to decide which blue you want to unprotect. I've also attached a UDF [ColorOfCell] that will tell you the # associated with the BLUE you want. Change the 'BlueColor' variable in the procedure to that #. '/============================/ Public Sub MakeBlueCellsUnProtected() Dim BlueColor As Long Dim rngCell As Range BlueColor = 16711680 'YOUR color Blue For Each rngCell In Application.ActiveSheet.UsedRange If rngCell.Interior.Color = BlueColor Then rngCell.Locked = False End If Next rngCell End Sub '/============================/ Function ColorOfCell(Select_Cell As Range) 'Color of Background in a cell 'Full numberic equivalent of color Application.Volatile True ColorOfCell = Select_Cell.Interior.Color End Function '/============================/ -- Hope this helps. If it does, please click the Yes button. Thanks in advance for your feedback. Gary Brown "violasrbest" wrote: Hi I have input cells coloured blue and I want to unlock these cells. I know I need to use Colorindex, but I can't work out how to put it all together. Many thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Unlock based on cell colour | Excel Programming | |||
Unlock certain cells based on ColorIndex | Excel Programming | |||
How do I set a colour to 4 cells based on the value of a cell | Excel Discussion (Misc queries) | |||
Is there away to have specific cells unlock based on the entry of information in another? | New Users to Excel | |||
Adding colour to a range of cells based on one of the cells v... | Excel Discussion (Misc queries) |