+ Reply to Thread
Results 1 to 12 of 12

Calling Macros from a Macro

  1. #1
    Registered User
    Join Date
    07-30-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    29

    Calling Macros from a Macro

    Hi all,

    I am having some difficulty "calling a macro from a macro"

    Please Login or Register  to view this content.
    Above is the start of the macro I would like to call.

    I assume that in order to call this macro I need to state the worksheet, range, and Title.

    How would it be best to do this in VBA?

    Thanks very much!!

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,540

    Re: Calling Macros from a Macro

    Is this what you mean?

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    328

    Re: Calling Macros from a Macro

    Where are you calling it from?

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Calling Macros from a Macro

    Maybe:

    Call Macroname

  5. #5
    Registered User
    Join Date
    07-30-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: Calling Macros from a Macro

    Hi all.

    Thanks for your reply.

    I'll explain a bit more.

    Call Macroname and Application.run makes sense however I need to define three objects in order to create a line chart -
    - The worksheet
    - The range for the data I want in my chart
    - The title.

    As you can probably tell I am a novice when it comes to VBA.

    So say I want to get the macro to create a chart called 'Cars' from columns A2:B200, form a worksheet called 'Sheet 1' how would I do that?'

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    You would call it like this.
    Please Login or Register  to view this content.
    Or like this.
    Please Login or Register  to view this content.
    Last edited by Norie; 08-07-2013 at 01:05 PM.
    If posting code please use code tags, see here.

  7. #7
    Registered User
    Join Date
    07-30-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: Calling Macros from a Macro

    Hi Norie,

    Thanks for your help.

    When Call the macro I need to define -

    Please Login or Register  to view this content.
    Is it just a case of writing

    Please Login or Register  to view this content.
    ?

    When I do that i receive a compile error.

    Thanks again for your help.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Did you try the code I posted?

  9. #9
    Registered User
    Join Date
    07-30-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: Calling Macros from a Macro

    I did, but unfortunately nothing happened

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Calling Macros from a Macro

    Strange, when I run it the sub called macroname is called and a new chart sheet is created.

  11. #11
    Registered User
    Join Date
    07-30-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: Calling Macros from a Macro

    Hmmm ok. I'll have a look into it. It could be a problem with the macro. Thanks very much for your help, much appreciated

  12. #12
    Registered User
    Join Date
    07-30-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: Calling Macros from a Macro

    Sorry for the late reply but it worked! Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro: Calling other macros dependant of the result of a specific cell
    By darrenkaye in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-17-2012, 11:53 AM
  2. Calling Macros
    By RBI in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-27-2008, 10:22 AM
  3. macro calling two diffrnt macros at different time intervals..
    By hotmalepiyush in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-28-2008, 04:28 AM
  4. Calling Macros
    By arvind68 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-13-2007, 10:31 AM
  5. Problems calling macros in addin from within macros
    By Andibevan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-16-2005, 05:05 AM

Tags for this Thread

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