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

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
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,214,415
Messages
6,119,382
Members
448,889
Latest member
TS_711

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