Consulting

Results 1 to 4 of 4

Thread: Solved: call a macro from within another macro works then doesn't

  1. #1
    VBAX Newbie
    Joined
    Sep 2011
    Posts
    4
    Location

    Solved: call a macro from within another macro works then doesn't

    Hi there,

    I'm using a button to run a macro. However what i'd like to do is have a message pop up when the mouse rolls over the button then when the button is clicked it moves to another sheet.
    The following shows the popup message


    Sub MyMacro1()
    Dim shp As Shape
    Set shp = ActiveSheet.Shapes("Rectangle 1")
    ActiveSheet.Hyperlinks.Add shp, "", "", ScreenTip:="Click button to move to Bank details"
    Call MyMacroA
    End Sub



    Is should call MyMacroA and move to another sheet/range using the following code

    Sub MyMacroA()
    Sheets("Sheet2").Select
    Range("A4").Select

    End Sub



    However sometimes this works sometimes it doesn't. For the life of me i can't see wha the problems is.
    Has anybody got any tips or ideas?
    Using Office 2010, on vista and windows 7
    Am i asking excel to do too much or does anybody have a simpler way of doing this?
    Many thanks in advance

  2. #2
    Hi yorkie,

    Try this:

    Option Explicit
    Sub Macro2()
        'http://www.vbaexpress.com/forum/showthread.php?t=39640
        Dim shp As Shape
        
        With Sheets("Sheet1")
            Set shp = .Shapes("Rectangle 1")
            .Hyperlinks.Add _
                Anchor:=shp, _
                Address:="", _
                SubAddress:="Sheet2!A4", _
                ScreenTip:="Click button to move to Bank details"
        End With
        
    End Sub
    HTH

    Robert

  3. #3
    VBAX Newbie
    Joined
    Sep 2011
    Posts
    4
    Location
    Thanks Robert that worked a treat - much appreciated.

  4. #4
    You're welcome

Posting Permissions

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