Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default 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
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
Change background colour hollies Excel Worksheet Functions 3 October 8th 09 11:54 PM
selected cells doesnot change colour Zarrar Janjua New Users to Excel 9 May 22nd 07 02:45 PM
change a cell background colour to my own RGB colour requirements Stephen Doughty Excel Discussion (Misc queries) 4 June 16th 06 01:08 PM
change highlight colour of selected cells Starskys Bird Excel Discussion (Misc queries) 1 April 29th 06 02:27 PM
change background colour cityfc Excel Discussion (Misc queries) 1 November 11th 05 01:03 PM


All times are GMT +1. The time now is 03:55 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"