Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Nimbus55
 
Posts: n/a
Default changing cell colour on click

I'd like to see a cell change colour when a user clicks it...How would I do
that?
Thanks
  #2   Report Post  
JE McGimpsey
 
Posts: n/a
Default

Would you settle for a double-click?

Private Sub Worksheet_BeforeDoubleClick( _
ByVal Target As Excel.Range, Cancel As Boolean)
Cancel = True
With Target.Interior
.ColorIndex = IIf(.ColorIndex = 3, xlColorIndexNone, 3)
End With
End Sub

You could do the same thing with a single click by using the
Worksheet_SelectionChange() event macro, but that would also be
triggered by tabbing, the Enter and arrow keys, etc.


In article ,
"Nimbus55" wrote:

I'd like to see a cell change colour when a user clicks it...How would I do
that?
Thanks

  #3   Report Post  
JE McGimpsey
 
Posts: n/a
Default

Forgot to say that this should go in your worksheet code module
(right-click the worksheet tab and choose View Code)

In article ,
JE McGimpsey wrote:

Would you settle for a double-click?

Private Sub Worksheet_BeforeDoubleClick( _
ByVal Target As Excel.Range, Cancel As Boolean)
Cancel = True
With Target.Interior
.ColorIndex = IIf(.ColorIndex = 3, xlColorIndexNone, 3)
End With
End Sub

You could do the same thing with a single click by using the
Worksheet_SelectionChange() event macro, but that would also be
triggered by tabbing, the Enter and arrow keys, etc.

  #4   Report Post  
Nimbus55
 
Posts: n/a
Default

Thank you....it's perfect!

"JE McGimpsey" wrote:

Forgot to say that this should go in your worksheet code module
(right-click the worksheet tab and choose View Code)

In article ,
JE McGimpsey wrote:

Would you settle for a double-click?

Private Sub Worksheet_BeforeDoubleClick( _
ByVal Target As Excel.Range, Cancel As Boolean)
Cancel = True
With Target.Interior
.ColorIndex = IIf(.ColorIndex = 3, xlColorIndexNone, 3)
End With
End Sub

You could do the same thing with a single click by using the
Worksheet_SelectionChange() event macro, but that would also be
triggered by tabbing, the Enter and arrow keys, etc.


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
Store max value of changing cell q5 Excel Worksheet Functions 0 July 22nd 05 04:05 AM
Changing Cell formats to date fields automatically PCLIVE Excel Worksheet Functions 3 April 12th 05 10:34 PM
up to 7 functions? ALex Excel Worksheet Functions 10 April 12th 05 06:42 PM
Link - deactivate being sent to source when click on linked cell? snidely Excel Worksheet Functions 1 January 11th 05 02:11 AM
Format Cell Colour scottymelloty Excel Worksheet Functions 2 November 17th 04 08:19 PM


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