PC Review


Reply
Thread Tools Rate Thread

conditional formatting on click

 
 
beverlydawn
Guest
Posts: n/a
 
      5th Mar 2008
I want a cell to turn grey when clicked on, also to be clear if clicked on
after it has been grey. Is that possible?
 
Reply With Quote
 
 
 
 
Barb Reinhardt
Guest
Posts: n/a
 
      5th Mar 2008
Right click on the tab and pull down to View Source

Paste this in the source for the sheet that is being modified

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

With Target.Interior
If .ColorIndex <> 15 Then
.ColorIndex = 15
Else
.ColorIndex = -4142
End If
End With

End Sub

--
HTH,
Barb Reinhardt



"beverlydawn" wrote:

> I want a cell to turn grey when clicked on, also to be clear if clicked on
> after it has been grey. Is that possible?

 
Reply With Quote
 
Gary''s Student
Guest
Posts: n/a
 
      5th Mar 2008
Try this worksheet event macro. It is coded for cell B9, but you can adjust
to suit your needs:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set t = Target
Set r = Range("B9")
If Intersect(t, r) Is Nothing Then Exit Sub
If r.Interior.ColorIndex = 15 Then
r.Interior.ColorIndex = xlNone
Else
r.Interior.ColorIndex = 15
End If
End Sub

--
Gary''s Student - gsnu200771


"beverlydawn" wrote:

> I want a cell to turn grey when clicked on, also to be clear if clicked on
> after it has been grey. Is that possible?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
My conditional formatting evaluates only when I double click cells JCo Microsoft Excel Misc 0 17th Nov 2009 11:44 AM
Protect Cell Formatting including Conditional Formatting =?Utf-8?B?TWljayBKZW5uaW5ncw==?= Microsoft Excel Misc 5 13th Nov 2007 05:32 PM
Conditional Formatting No Longer Conditional in 2007 Beta =?Utf-8?B?Q2FjdHVhci1Oby1KdXRzdQ==?= Microsoft Excel Crashes 0 17th Nov 2006 10:01 PM
How do I do a complex conditional in a conditional formatting formula Ray Stevens Microsoft Excel Discussion 7 12th Mar 2006 10:24 PM
Conditional Formatting that will display conditional data =?Utf-8?B?QnJhaW5GYXJ0?= Microsoft Excel Worksheet Functions 1 13th Sep 2005 05:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:35 AM.