A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Excel Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

how do I lock the fill color in a cell



 
 
Thread Tools Display Modes
  #1  
Old February 8th 09, 01:22 PM posted to microsoft.public.excel.worksheet.functions
Graham
external usenet poster
 
Posts: 155
Default how do I lock the fill color in a cell

Can i lock the fill color in a cell so when something is copied to that cell
it stays the locked color.

Thank You
Ads
  #2  
Old February 8th 09, 02:06 PM posted to microsoft.public.excel.worksheet.functions
Gary''s Student
external usenet poster
 
Posts: 11,059
Default how do I lock the fill color in a cell

This is an example using cell A1:

1. set the background color of cell A1
2. enter the following macro in a standard module:

Public oldcolor As Integer
Public lockcell As Range
Sub remember()
If lockcell Is Nothing Then
Set lockcell = Range("A1")
oldcolor = lockcell.Interior.ColorIndex
End If
End Sub

3. Enter this event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
If lockcell Is Nothing Then Exit Sub
If Intersect(lockcell, Target) Is Nothing Then Exit Sub
lockcell.Interior.ColorIndex = oldcolor
End Sub

4. run the remember macro
--
Gary''s Student - gsnu200832


"Graham" wrote:

> Can i lock the fill color in a cell so when something is copied to that cell
> it stays the locked color.
>
> Thank You

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I fill one cell color with text html/rgb color from another thewris Excel Discussion (Misc queries) 2 January 22nd 09 12:24 AM
color of cell fill janlanac Excel Worksheet Functions 2 October 5th 07 12:57 AM
I need to lock cell color, but allow text - how do I do this? cgotzeff Excel Discussion (Misc queries) 1 July 5th 06 02:47 PM
Cell Fill Color and text color - changes for recipient Shadowman13 Excel Discussion (Misc queries) 0 March 8th 06 11:32 PM
Lock or Unlock cell references in a formula for auto fill purposes David P. Excel Discussion (Misc queries) 2 June 6th 05 11:18 PM


All times are GMT +1. The time now is 12:49 PM.


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