Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change background colour of selected cells
This version appears to adequately compensate for the problem described if
you need to only copy and paste values. You will need to set a reference to the Microsoft Forms 2.0 Object Library for it to work. Paste all of the below to the worksheet's code module. Minimal testing and never used personally:- Dim copyval As String Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.FormatConditions.Delete If Len(copyval) 0 Then CopyToClip (copyval) With Target If .Count 1 Then Exit Sub copyval = .Value .FormatConditions.Add Type:=xlExpression, Formula1:="TRUE" .FormatConditions(1).Interior.ColorIndex = 19 End With End Sub Private Sub CopyToClip(txt) Dim DataObj As DataObject Set DataObj = New DataObject DataObj.SetText txt DataObj.PutInClipboard Set DataObj = Nothing End Sub Regards, Greg |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
selected cells doesnot change colour | New Users to Excel | |||
Change background colour of selected cells | Excel Programming | |||
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) |