Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

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
Right Mouse Click StephenD Excel Discussion (Misc queries) 4 May 27th 09 04:24 PM
right click on the mouse does not work S Excel Discussion (Misc queries) 6 May 22nd 08 09:42 AM
Crash on mouse click SpartyTower Excel Discussion (Misc queries) 0 November 8th 06 03:31 PM
Run Macro on Mouse Click vacation Excel Worksheet Functions 8 July 24th 06 04:10 PM
Each Click of the Mouse D.Parker Excel Discussion (Misc queries) 13 April 28th 05 11:24 PM


All times are GMT +1. The time now is 12:33 PM.

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"