VB: Change Mouse Cursor when over a specific cell. 'Hover' vb?

Anonymous
2014-10-20T00:55:48+00:00

hi,  i have been trying to see if there is a way to change a mouse icon when i hover over specific a cell(s).  i wonder if there is a 'hover' vb that can help with that.

i would rather have the same hand icon that occurs when pointing to a hyperlink, but that does not seem to have been made available to us.

if viable, an arrow icon would be acceptable.  i have the following example of vb that works 'as is' to toggle between / test icons:

    If Application.Cursor <> xlDefault Then

      Application.Cursor = xlDefault

    Else

      Application.Cursor = xlNorthwestArrow

    End If

isn't there some kind of 'HOVER' vb that will allow this to happen when over a specific cell.

its use will include a function that was made for a scroll row  'hyperlink' type vb that has:

    If UCase(Left(strFormula, 6)) = UCase("=QLINK") Then

in other words, to activate the hover - change cursor, when hovering over a cell that has the left 6 characters as shown above.

other idea for trying to simulate the cursor:  when using the following formula i get the hand cursor when hovering over the cell.

i would think there should be some vb to simulate the same effect.

=HYPERLINK(AZ573,"T1")

this hyperlink requires a double click, and i wonder if that would work for tricking the situation for a cursor change, when the vb link working on will (hopefully), be a single click.  i have not been able to make work the idea heard for putting a 0,0 reference into a hyperlink, as a null reference, but checking into that.  putting the same cell reference in the hyperlink above, gets an error.  just use ON ERROR GOTO ?

like i was saying,  using the arrow cusor will at least work for now if can get hover? vb help on that..  thanks.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

8 answers

Sort by: Most helpful
  1. Anonymous
    2014-10-22T05:38:37+00:00

    Davexx:

    I'm probably not understanding you, but I thought I'd fire off something hoping it will help. Be advised that this came from just goofing around. It's not what you asked for but I thought I'd offer it as an alternative. It's fairly quick to implement. Just enter, say, "=QLink(J50)", format the cell as "Marlett" with size 18 font and you're done. In this case, clicking the cell will cause selection to jump to cell J50. Detailed instructions follow.

    Suggestion:

    1)  Format the font of the desired cell as "Marlett",

    2)  Set the font size to something suitably large (e.g. 18),

    3)  Type "=QLINK(L100)" into the cell,

    4)  Paste the below Worksheet_SelectionChange code into the worksheet's Class module,

    5)  Paste the below QLink function code into a standard module.

    Note that the number 5 in Marlett font looks like an UP arrow and the number 6 looks like a DOWN arrow. The function itself will change the arrow to point in the appropriate direction, either up or down, depending on if the destination is above or below the cell containing the formula. See the below picture.

    Paste into the worksheet's Class module:

    Option Explicit

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    Dim strFormula As String, addr As String

    If Target.Cells.Count = 1 Then

        strFormula = Target.Formula

        If Left(strFormula, 6) = "=QLink" Then

            addr = Mid$(strFormula, 8, Len(strFormula) - 8)

            Range(addr).Select

        End If

    End If

    End Sub

    Paste into a standard code module:

    Function QLink(c As Range) As String

    Select Case Range(Application.Caller.Address).Row

    Case Is < c.Row

        QLink = 6

    Case Else

        QLink = 5

    End Select

    End Function

    Greg Wilson

    0 comments No comments
  2. Anonymous
    2014-11-02T20:09:59+00:00

    hi,  sorry for the time for reply.. 

    just a glance at your post.  i think its easy for me to log details of what doing, without going back and making a concise goal / of what doing..

    if not understood,  just looking to be able to vb the use of a cursor under any met condition.

    for this, had idea to have a cursor effect take place, even if only secondary to the primary vb of say: a hyperlink to another cell (single click),  where if the pointer changes due to something requiring a double click i was hoping to trick a cursor change to take effect.  it might not be that easy or something to get after much experiment.  just thought someone else might have the solution already.

    had some problems with my pc (monitor only working if put heater on back of it :)  / during warm part of day.  new monitor pending.  been running a bit slow myselft.  back in a week or more.. thanks.

    0 comments No comments
  3. Anonymous
    2014-11-03T04:40:39+00:00

    Davexx:

    I'm sorry to say that I still don't understand what you are trying to do. So I'll leave it to someone else. For their benefit I'll ask a couple of questions:

    1)  I thought you were asking how to simulate the mouse pointer change produced by a hyperlink - i.e. detect when the mouse pointer is over the cell containing the hyperlink without having to click the cell. This requires monitoring the mouse-move event. Again, what is it you are trying to do?

    2)  The double-click event can easily be detected. So can the right-click and selection-change events. The cursor change can be made in response to detecting these events. However, I didn't think you wanted this. What event do you accept that will trigger the mouse pointer change? (assuming you still want to change the mouse pointer).

    Greg Wilson

    0 comments No comments