Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
In a Shared Workbook of Excel, how do I change the color of a Cel.
In a Shared Workbook of Excel, how do I change the color of a Cell by simply
selecting it. For example, if I click on Cell B234 making it the Active Cell, I want the color of Cell G234 to change to yellow. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
In a Shared Workbook of Excel, how do I change the color of a Cel.
Ahmed
Try putting this code on the sheet. (Get into VBA and then Double-click on the sheet object) Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.Interior.ColorIndex = xlNone ActiveCell.Interior.ColorIndex = 6 End Sub Peter Bircher "Ahmed" wrote in message ... In a Shared Workbook of Excel, how do I change the color of a Cell by simply selecting it. For example, if I click on Cell B234 making it the Active Cell, I want the color of Cell G234 to change to yellow. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
In a Shared Workbook of Excel, how do I change the color of a
Thank you, Pete, for responding. However, I get the following error message
when I attempt to run your code: "Unable to set the ColorIndex property of the Interior Class. I've been using the following code, but it does not work with a Shared Workbook: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim iColor As Integer '// Note: Don't use if you have conditional '// formatting that you want to keep '// On error resume in case user selects a range of cells On Error Resume Next iColor = Target.Interior.ColorIndex '// Leave On Error ON for Row offset errors If iColor < 0 Then iColor = 36 Else iColor = iColor + 1 End If '// Need this test in case Font color is the same If iColor = Target.Font.ColorIndex Then iColor = iColor + 1 Cells.FormatConditions.Delete '// Horizontal color banding With Range("Z" & Target.Row, Target.Address) 'Rows(Target.Row) .FormatConditions.Add Type:=2, Formula1:="TRUE" .FormatConditions(1).Interior.ColorIndex = iColor End With End Sub "Pete" wrote: Ahmed Try putting this code on the sheet. (Get into VBA and then Double-click on the sheet object) Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.Interior.ColorIndex = xlNone ActiveCell.Interior.ColorIndex = 6 End Sub Peter Bircher "Ahmed" wrote in message ... In a Shared Workbook of Excel, how do I change the color of a Cell by simply selecting it. For example, if I click on Cell B234 making it the Active Cell, I want the color of Cell G234 to change to yellow. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
can not change size of shared workbook | Excel Discussion (Misc queries) | |||
Format Change in Shared Workbook | Excel Worksheet Functions | |||
Change protection of a shared workbook (Excel 2000) | Excel Discussion (Misc queries) | |||
Change scrollbar color in workbook in Excel XP | New Users to Excel | |||
cant not change history on a shared workbook | Excel Discussion (Misc queries) |