Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
I'd like to see a cell change colour when a user clicks it...How would I do
that? Thanks |
#2
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Store max value of changing cell | Excel Worksheet Functions | |||
Changing Cell formats to date fields automatically | Excel Worksheet Functions | |||
up to 7 functions? | Excel Worksheet Functions | |||
Link - deactivate being sent to source when click on linked cell? | Excel Worksheet Functions | |||
Format Cell Colour | Excel Worksheet Functions |