![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 11:45 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com