ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   mouse click or mouseover and get color (https://www.excelbanter.com/excel-programming/317442-mouse-click-mouseover-get-color.html)

sakijung[_3_]

mouse click or mouseover and get color
 

Good evening. Please help me to edit this macro code.
Sub Macro1()
With Selection.Interior
ColorIndex = 6
Pattern = xlSolid
End With
Range("G1").Select
With Selection.Interior
ColorIndex = 6
Pattern = xlSolid
End With
End Sub
The problem is I would like to click mouse to highlight the cell. And
I want this code to do some picture on stand cheer with my students in
sport day. I don't want to click the color plate and click on cell. I
just want one click. For example I select the yellow and then I click
mouse on any cell to make heart shaped such as j1 k1 j2 k2,......
Thank you.


--
sakijung
------------------------------------------------------------------------
sakijung's Profile: http://www.excelforum.com/member.php...fo&userid=4797
View this thread: http://www.excelforum.com/showthread...hreadid=319021


Rob van Gelder[_4_]

mouse click or mouseover and get color
 
There is no SingleClick event for a worksheet.
There is an event called SelectionChange, but for your request I believe you
would find this more troublesome than it's worth.

How about DoubleClick?

Here's how:
Right-click the sheet tab, select View Code.

Paste this code:

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


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"sakijung" wrote in message
...

Good evening. Please help me to edit this macro code.
Sub Macro1()
With Selection.Interior
ColorIndex = 6
Pattern = xlSolid
End With
Range("G1").Select
With Selection.Interior
ColorIndex = 6
Pattern = xlSolid
End With
End Sub
The problem is I would like to click mouse to highlight the cell. And
I want this code to do some picture on stand cheer with my students in
sport day. I don't want to click the color plate and click on cell. I
just want one click. For example I select the yellow and then I click
mouse on any cell to make heart shaped such as j1 k1 j2 k2,......
Thank you.


--
sakijung
------------------------------------------------------------------------
sakijung's Profile:
http://www.excelforum.com/member.php...fo&userid=4797
View this thread: http://www.excelforum.com/showthread...hreadid=319021




sakijung[_4_]

mouse click or mouseover and get color
 

Kob-Kun-Krub (Thank you in English)
The code that you tell is extremely excellent. Thank you again.


--
sakijung
------------------------------------------------------------------------
sakijung's Profile: http://www.excelforum.com/member.php...fo&userid=4797
View this thread: http://www.excelforum.com/showthread...hreadid=319021



All times are GMT +1. The time now is 04:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com