Autoshape Mouse Over Macro

DJLA

New Member
Joined
Oct 19, 2006
Messages
5
I want to run a macro when the user runs the mouse over the surface of an Autoshape. What is the best way to do this?
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Autoshapes only has the Click event.
There is a way around this limitation, but it depends on what you want to do with it...

Draw a Label (control toolbox) over the Autoshape, and set the Label's BackStyle property to Transparent.

Then use the MouseMove event for the Label.

Here's the downside: As the mouse moves across the Autoshape (Label), the SUB will execute many times. If you want it to turn something on or pop up a MsgBox then it should work okay for you. But if you want it to, say, add a number, it will do it multiple times with only one "visit" of the mouse over the Autoshape because it is seeing it "move" that is change X & Y mouse positions many times. You can get it to execute only once by using Label1.Visible = False but you will need to set it back to True when the mouse is not over the Label.
 
Upvote 0

Forum statistics

Threads
1,214,414
Messages
6,119,375
Members
448,888
Latest member
Arle8907

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top