Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default conditional formatting on click

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default conditional formatting on click

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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default conditional formatting on click

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
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
My conditional formatting evaluates only when I double click cells JCo Excel Discussion (Misc queries) 0 November 17th 09 11:44 AM
Excel 2007 crashes when I right-click or try formatting a cell Madhu Excel Discussion (Misc queries) 2 October 6th 08 09:47 AM
Unable to use right-click on cells; standard and formatting toolbars disabled Trizi Excel Discussion (Misc queries) 3 June 22nd 07 04:17 AM
Help with formatting right-click menu caption. Delmar D'Percy Excel Programming 2 March 14th 06 01:54 PM


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