Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unlock based on cell colour violasrbest Excel Programming 4 April 26th 10 04:51 PM
Unlock certain cells based on ColorIndex Samantha Excel Programming 2 April 22nd 08 06:16 PM
How do I set a colour to 4 cells based on the value of a cell Andy64 Excel Discussion (Misc queries) 1 September 6th 05 06:46 PM
Is there away to have specific cells unlock based on the entry of information in another? Marc New Users to Excel 2 April 17th 05 06:09 PM
Adding colour to a range of cells based on one of the cells v... McKenna Excel Discussion (Misc queries) 4 March 11th 05 03:25 PM


All times are GMT +1. The time now is 07:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"