Share via

VB: Mouse Pointer vb when hover over a cell, like hyperlink

Anonymous
2014-10-10T22:56:29+00:00

UPDATE:  note that there has not been found an actual answer to this,  yet?  for as aked:)  still checking..  seeing if another way to ask question / simulate the requried result.  easy vb not seem to accomodate a 'hand' mouse pointer icon.  will include angle left arrow..  thanks.

==========

hi,  i am curious if there is a vb for excel where you hover over a cell then the pointer changes to the same pointer as when hover over a hyperlink.  thanks.

ie:

if my other vb true.. then  (if left formula 6? = qlink.. then) 

mouse pointer hover activate? over cell

my vb

end if

==========

i have found the following information:  checking / might need help in its application when hover over a cell,  for eg:  if .selection =  then

i would prefer to get a HAND POINTER to do the same trick as is normally done in excel.

Sub ChangeCursor()

Application.Cursor = xlNorthwestArrow

'Application.Cursor = xlWait      'hourglass

'Application.Cursor = xlBeam      '

'HAND POINTER??   http://msdn.microsoft.com/en-us/library/system.windows.forms.cursors.hand%28v=vs.110%29.aspx

 'For X = 1 To 1000   'for coordinates?

 'For Y = 1 To 1000

 'Next Y

 'Next X

Application.Cursor = xlDefault   'reset to default when done

End Sub

found samples at:

http://www.mrexcel.com/forum/excel-questions/681925-userform-hand-mouse-icon-when-scroll-over-buttons.html

http://stackoverflow.com/questions/46805/custom-cursor-in-wpf


with some of the examples for icons i have found..  have to check but one simple version (if can do by vb),  suggested that one could simulate the same hand icon over a cell by right clicking? and creating a hyperlink to that cell with offset? as 0,0.  :)  not sure if that is a good thing to do,  or if there might be some vb that would simulate that, without any drawbacks of the hyperlink?  just speculating - checking.


i have found some code that wonder if will work,  i am trying to figure out how to apply it.

on the UserForm for the label (or relevant control) MouseMove and MouseDown events:

SetHandCur True

When the cursor is over the control, the cursor changes, and using the

MouseDown event ensures that the cursor does not revert to default

when clicking a mouse button.

in a module:

Public Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" _

(ByVal hInstance As Long, ByVal lpCursorName As Long) As Long

Public Declare Function SetCursor Lib "user32" _

(ByVal hCursor As Long) As Long

Public Const IDC_HAND = 32649&

Public Const IDC_ARROW = 32512&

Public Sub SetHandCur(Hand As Boolean)

If Hand = True Then

SetCursor LoadCursor(0, IDC_HAND)

Else

SetCursor LoadCursor(0, IDC_ARROW)

End If

End Sub

'IDC_CROSS = 32515&

'IDC_HAND = 32649&

'IDC_ARROW = 32512&

'IDC_UPARROW = 32516&

'IDC_APPSTARTING = 32650&

'IDC_IBEAM = 32513&

'IDC_ICON = 32641&

'IDC_SIZE = 32640&

'IDC_SIZEALL = 32646&

'IDC_WAIT = 32514&

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

Answer accepted by question author

Anonymous
2014-10-11T18:37:12+00:00

Hi Dave.

This isn't going to happen because there is no event that you can use to trigger the change of mouse pointer when you move over a cell. 

If only you could / would do the equivalent of your hyperlink in-cell formula in vba then you could get the  vba to insert a proper hyperlink to the required destination cell.... do you think it's time to explore that?

Cheers

Rich

Was this answer helpful?

0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2014-10-14T14:57:59+00:00

    hi,  thanks.  will check that out.  will check for any things that will simulate the effect. 

    note:  easier to post here item related to qlinks.  on a vb for scroll row  (qlink or other:  "dn" links),  i got the header flash to go away by somehow skipping:  DESTINATION SELECT of new location. 

        (if thats a small bug by not having cursor end up at destination, can live with that).

    along with combining into one line:  the destination and  Scrollrow items, i was able to reduce all to 1 step - for no extra 'header' screen flash.  i still need to check out the qlink single click example,  been busy. 


    back to hyperlinks pointer.   is there a VB EQUIVALENT for this:

    one thing did see double click required when i used:  =HYPERLINK(BH569,"T")

     for a different cell same line, was the need to double click the link to get link to move.  (ie pointer came up & might work if there is some vb equivalent to make double click never happen on a single click enviroment..),  just an idea.

    not sure if you meant you had a vb in mind, at least from your first post for "simulate" a selection pointer.

      >>  QUESTION:  Is there a VB for insert a virtual Hyperlink??  guessing need for something that would get a null result / address 0,0  ?  just to get the mouse pointer to work.  thanks. 

    i would not need the vb to atually insert a hyperlink, nor to make any other physical changes to a cell.  just some virtual link similar to the example above.

    ==========

      - attempts to find insert a hyperlink included:  (stuff from online not even able to get working yet)

    'ActiveSheet.Hyperlinks.Add Anchor:=ActiveSheet.Cells(l, 1), Address:="", SubAddress:=wSheet.Cells(1, 1), TextToDisplay:=wSheet.Name

    'ActiveCell.FormulaR1C1 = "=HYPERLINK(RC[2],""t"")"

    'RANGE("A1").HYPERLINKS(1).Follow

    'Sheets("sample").Cells(Eventid, 7).Formula = "=HYPERLINK(""http://finance.yahoo.com/q/hp?s=" & Companyid & "&a=00&b=1&c=1998&d=01&e=1&f=2009&g=d"",""" & Companyid & """)"

    'Sheets("Sheet3").Hyperlinks.Add Sheets("Sheet3").Cells(3, 3), "", Sheets("Sheet1").Name & "!B2", "", "Hello"

    'RANGE("BH569").HYPERLINKS(2).Follow

    'Worksheets(1).Range("BB587").Hyperlinks(2).Follow

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2014-10-13T16:34:35+00:00

    You could use Conditional Formatting to identify cells that contain a QLINK formula.

    You can use the FORMULATEXT function to see what formula is in a cell.

    e.g.

    With cell A1 selected > Conditional Formatting > Use a formula to determine which cells to format >

    =LEFT(FORMULATEXT(A1),6)="=QLINK"

    That will return true when the formula in A1 starts with "=QLINK".

    But as you know, there is no way to change the mouse pointer with conditional formatting....

    Was this answer helpful?

    0 comments No comments