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
 

ajetrumpet

Banned for being rude
Joined
Apr 12, 2008
Messages
569
Office Version
365, 2016, 2007
Platform
Windows
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...
 

Tom Urtis

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,197
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
 

Forum statistics

Threads
1,081,777
Messages
5,361,231
Members
400,618
Latest member
Gamaway

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top