Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change background colour of selected cells
Paste this to the worksheet's code module:-
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.FormatConditions.Delete With Target If .Count 1 Then Exit Sub .FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" .FormatConditions(1).Interior.ColorIndex = 19 End With End Sub The downside of using worksheet event code is that it kills the contents of the clipboard. You will notice that if you copy something and then attempt to paste it to another cell the Paste button is grayed. You will need code to correct this. Alternatively, you can still drag and drop to cut and paste. And if you hold down the Ctrl key and drag and drop it will copy and paste. Regards, Greg "Redleg" wrote: I wish to change the background colour of any selected cell on entry and revert to original colour (none) on exit. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Change background colour | Excel Worksheet Functions | |||
selected cells doesnot change colour | New Users to Excel | |||
change a cell background colour to my own RGB colour requirements | Excel Discussion (Misc queries) | |||
change highlight colour of selected cells | Excel Discussion (Misc queries) | |||
change background colour | Excel Discussion (Misc queries) |