VB: vba action for simulate: Click a Cell

Anonymous
2016-03-09T15:53:00+00:00

how to execute a mouse function?  i do not need an execute if click on a cell.  i need a function that simulates the click itself.

i would like the hyperlink in the cell to activate from a vb simulated click.

i have an answer that does a split & follow hyperlink, but that is not what i need.

for other vb i had:    application.doubleclick  work

is there a way to make the vb perform a single click on the selected cell.  thanks.

i tried a couple of these:

    application.singleclick    'no such animal

    application.click

    click

i do not need a mouse click event.

i need the vb to perform a click on a selected cell.

==========

i can save another post on a similar problem:

how do i limit a vb to performing the task only once / for one mouse click.  the problem would be if 2 clicks were accidently performed.

eg:  i do not want 2 saves workbooks to take place, when i hit a "Save Workbook" macro - button.  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

6 answers

Sort by: Most helpful
  1. Anonymous
    2016-03-09T21:18:35+00:00

    hi,  thanks.  too funny if i messed up not giving enough info..   but popup got with that eg was

    i could not get that to work either. 

        ActiveWorkbook.FollowHyperlink ActiveCell.Value   'cannot open the specified file

    i have been using a hyperlink with connecting cells to make a full web address, using andpersands.

    i think i was just running on original assumption of just click on a cell.

    examples:

    =HYPERLINK($BM$4&BH866&IF($AA$1=1,"",IF(LEFT(AO866,1)="&",AO866&$BQ$6,$BM$5&H866)&IF(AS866="x",$BQ$5,IF(AS866="y",$BR$5,IF(AS866="z",$BS$5,$BM$6)))),IF(P866>0,"O",IF(H866=20,"A",IF(FU866<0.0004,"F",MIN(S866,9)))))

    gets:

    http://bigcharts.marketwatch.com/advchart/frames/frames.asp?show=&insttype=Stock&symb=DIRV&time=18&startdate=4%2F1%2F2015&enddate=3%2F9%2F2016&freq=9&compidx=aaaaa%3A0&comptemptext=&comp=none&ma=1&maval=12%2C19%2C29%2C39%2C100%2C100&uf=0&lf=268435456&lf2=0&lf3=0&type=64&style=340&size=3&x=30&y=19&timeFrameToggle=false&compareToToggle=false&indicatorsToggle=false&chartStyleToggle=false&state=8

    =HYPERLINK(IF(OR(LEFT(AQ866,1)="m",$BQ$1="y"),$BP$4&BH866,$BQ$2&BH866&$BQ$3),IF(OR(LEFT(AQ866,1)="m",$BQ$1="y"),"Y",$X$8))

    gets:

    https://encrypted.google.com/search?complete=0&num=100&hl=en&safe=off&q=%22DIRV%22+AND+delist+1.02+OR+3.01+site:http:%2F%2Fbiz.yahoo.com%2Fe%2F

    ==========

    if this is any further isolated, is where at on an example for click a cell vb.  not yet working though:

    sites do not show how to apply vb / what- where.  'NOT WORKING:

    (put the following as is, in a module)

    Option Explicit

    Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

    Private Const MOUSEEVENTF_LEFTDOWN  As Long = &H2

    Private Const MOUSEEVENTF_LEFTUP    As Long = &H4

    'Const MOUSEEVENTF_LEFTDOWN  As Long = &H2

    'Const MOUSEEVENTF_LEFTUP    As Long = &H4

    'Const MOUSEEVENTF_LEFTDOWN = &H2

    'Const MOUSEEVENTF_LEFTUP = &H4

    Sub goClick()

        mouse_event MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&

        mouse_event MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&

    End Sub

    0 comments No comments