mouseover/mousebutton

feather1000

New Member
Joined
Feb 18, 2009
Messages
14
:confused:I'm trying to write a visual script in Excel 2003. With what i've read. its not quite sure 100% if it would work.


example.

if mouseover.A2:A4 then goto .......



Any help would definately be helpful
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
I don't think there is a mouse over event. From the help menu there is only mouseup, mousedown and movemove over a chart, so if you're wanting soemthing to happpen as you move your mouse from over one cell to the next, i don't think you can accomplish it. I would be very surprised if there was an easy solution to this as well...
 
Upvote 0
This is possible to achieve with a little API code but you would not want to do that, it will be a continuously running loop to keep the x and y coordinates updated with every mouse move. Also, range A1 and A2's x and y coordinates, as is the case with any cell on the grid, would depend on the row height and column width of those cells, meaning if you widen or narrow column or column 2, or increase or decrease the row height of row 1, then you'd need to update your macro by hard-coding those coordinates after you determine what they are again.

Instead, stick a label control from the active x control toolbox onto range A1:A2. You can use the fill handles with yoru other hand on the Alt key to "snap" the lable into place so it fits perfectly inside that 2-cell range. In the Properties window, delete the caption and set the BackStyle to transparent.

Doubleclick on the Label, which will take you to the woksheet module, and paste in

Code:
Private Sub Label1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Range("D4").Select 'modify for where you want to go
End Sub

Press Alt+Q to return to the worksheet.

Exit Design Mode, there is an icon for that on the control toolbox.

Now when you mouse over A1 and A2, the cells will appear normal but cell D4 will become active.
Press
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,930
Members
452,367
Latest member
TePunaBloke

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