+ Reply to Thread
Results 1 to 4 of 4

Worksheet_SelectionChange

  1. #1
    Gary''s Student
    Guest

    Worksheet_SelectionChange

    I am using the following macro to run whenever B2 is selected:

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Address <> "$B$2" Then Exit Sub
    On Error Resume Next
    Application.EnableEvents = False
    MsgBox ("hi")
    Application.EnableEvents = True
    End Sub

    The macro works just fine; click on B1 and the macro runs.

    B1 contains a hyperlink. The click also causes the hyperlink to be followed
    (simultaneously??).

    Is there anyway I can force the macro to execute completely before the
    hyperlink gets followed?
    --
    Gary's Student

  2. #2
    Jim Cone
    Guest

    Re: Worksheet_SelectionChange

    Hello GS,
    You could put a fake hyperlink in the cell.. blue colored font with an underline.
    Then at the end of your Sub, you could add code to duplicate the hyperlink action,
    maybe an Application.GoTo.
    --
    Jim Cone
    San Francisco, USA
    http://www.realezsites.com/bus/primitivesoftware


    "Gary''s Student" <GarysStudent@discussions.microsoft.com>
    wrote in message
    news:47660007-30DA-4894-B762-8895DA3D7935@microsoft.com...
    I am using the following macro to run whenever B2 is selected:

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Address <> "$B$2" Then Exit Sub
    On Error Resume Next
    Application.EnableEvents = False
    MsgBox ("hi")
    Application.EnableEvents = True
    End Sub

    The macro works just fine; click on B1 and the macro runs.
    B1 contains a hyperlink. The click also causes the hyperlink to be followed
    (simultaneously??).
    Is there anyway I can force the macro to execute completely before the
    hyperlink gets followed?
    --
    Gary's Student

  3. #3
    Jim Cone
    Guest

    Re: Worksheet_SelectionChange

    Actually, you could have a real hyperlink in the cell, just link it back
    to itself... Cell B2 hyperlinked to Cell B2.
    Jim Cone


    "Jim Cone" <jim.coneXXX@rcn.comXXX> wrote in message...
    Hello GS,
    You could put a fake hyperlink in the cell.. blue colored font with an underline.
    Then at the end of your Sub, you could add code to duplicate the hyperlink action,
    maybe an Application.GoTo.
    --
    Jim Cone
    San Francisco, USA
    http://www.realezsites.com/bus/primitivesoftware


    "Gary''s Student" <GarysStudent@discussions.microsoft.com>
    wrote in message
    news:47660007-30DA-4894-B762-8895DA3D7935@microsoft.com...
    I am using the following macro to run whenever B2 is selected:

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Address <> "$B$2" Then Exit Sub
    On Error Resume Next
    Application.EnableEvents = False
    MsgBox ("hi")
    Application.EnableEvents = True
    End Sub

    The macro works just fine; click on B1 and the macro runs.
    B1 contains a hyperlink. The click also causes the hyperlink to be followed
    (simultaneously??).
    Is there anyway I can force the macro to execute completely before the
    hyperlink gets followed?
    --
    Gary's Student

  4. #4
    Gary''s Student
    Guest

    Re: Worksheet_SelectionChange

    Thank you Jim
    --
    Gary''s Student


    "Jim Cone" wrote:

    > Actually, you could have a real hyperlink in the cell, just link it back
    > to itself... Cell B2 hyperlinked to Cell B2.
    > Jim Cone
    >
    >
    > "Jim Cone" <jim.coneXXX@rcn.comXXX> wrote in message...
    > Hello GS,
    > You could put a fake hyperlink in the cell.. blue colored font with an underline.
    > Then at the end of your Sub, you could add code to duplicate the hyperlink action,
    > maybe an Application.GoTo.
    > --
    > Jim Cone
    > San Francisco, USA
    > http://www.realezsites.com/bus/primitivesoftware
    >
    >
    > "Gary''s Student" <GarysStudent@discussions.microsoft.com>
    > wrote in message
    > news:47660007-30DA-4894-B762-8895DA3D7935@microsoft.com...
    > I am using the following macro to run whenever B2 is selected:
    >
    > Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    > If Target.Address <> "$B$2" Then Exit Sub
    > On Error Resume Next
    > Application.EnableEvents = False
    > MsgBox ("hi")
    > Application.EnableEvents = True
    > End Sub
    >
    > The macro works just fine; click on B1 and the macro runs.
    > B1 contains a hyperlink. The click also causes the hyperlink to be followed
    > (simultaneously??).
    > Is there anyway I can force the macro to execute completely before the
    > hyperlink gets followed?
    > --
    > Gary's Student
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1