Thread: Shade a cell
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Shade a cell

I did before I posted.

I put 7 in A1.
I used a CF rule #1 of value = 7 and changed the fill color.
I finished up and the CF was in effect.

I added your code behind the worksheet and selected a different location. Then
back to A1 and my shading was gone. I looked at the CF rule and yours was in
its place.

What am I missing?

Don Guillett wrote:

Dave,

Test it. You can even add new.

--
Don Guillett
SalesAid Software

"Dave Peterson" wrote in message
...
You sure?

Application.Cells.FormatConditions.Delete

Looks like it would destroy any existing conditional formats.



Don Guillett wrote:

The one I posted will NOT

--
Don Guillett
SalesAid Software

"JMay" wrote in message
...
Caution!!
This will, of course, "destroy" any and all other conditional
formatting you have or need to maintain in the sheet.


"Bob Phillips" wrote:

'----------------------------------------------------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'----------------------------------------------------------------
Cells.FormatConditions.Delete
With Target
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="TRUE"
.FormatConditions(1).Interior.ColorIndex = 36
End With

End Sub


'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Lavanya" wrote in message
...
I need a cell to get shaded when i click on it. how can i do that?




--

Dave Peterson


--

Dave Peterson