+ Reply to Thread
Results 1 to 6 of 6

How to run a macro in code

  1. #1
    Man Utd
    Guest

    How to run a macro in code

    After I created a macro, how do I run this macro in code ?



  2. #2
    Snake Plissken
    Guest

    Re: How to run a macro in code

    sub created_makro()

    'bla bla

    end sub


    sub other_macro()

    call created_makro

    end sub


    is that what u looking for?

    > After I created a macro, how do I run this macro in code ?
    >
    >


  3. #3
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good morning Man Utd (???)

    ...or if you're feeling really lazy you can miss out the "Call".

    Sub other_macro()
    created_makro
    End Sub

    HTH

    DominicB

  4. #4
    keepITcool
    Guest

    Re: How to run a macro in code


    exactly the OP's point

    other_macro will give compile error
    if created_macro does not exist.

    use
    application.run thisworkbook.name & "!created_macro"

    make sure created_macro is not private.


    --
    keepITcool
    | www.XLsupport.com | keepITcool chello nl | amsterdam


    Snake Plissken wrote :

    > sub created_makro()
    >
    > 'bla bla
    >
    > end sub
    >
    >
    > sub other_macro()
    >
    > call created_makro
    >
    > end sub
    >
    >
    > is that what u looking for?
    >
    > > After I created a macro, how do I run this macro in code ?
    > >
    > >


  5. #5
    Man Utd
    Guest

    Re: How to run a macro in code

    Sorry for my lack of macro knowledge, I think macro is a sort of
    function/procedure.
    What I need to do is:
    When I fill in the cell in worksheet A, eg. B3 has value "Peter", I will
    call a macro/function/procedure to search through a range of cells in
    worksheet B, eg. A2:D200, if I find the matched value in column A is also
    "Peter", eg A10, then I need to fetch the values of B10, C10, D10, fill in
    the worksheet A cells C3, D3, E3 from the corresponding row in the worksheet
    B of the matched value.

    "keepITcool" <[email protected]> wrote in message
    news:[email protected]...
    >
    > exactly the OP's point
    >
    > other_macro will give compile error
    > if created_macro does not exist.
    >
    > use
    > application.run thisworkbook.name & "!created_macro"
    >
    > make sure created_macro is not private.
    >
    >
    > --
    > keepITcool
    > | www.XLsupport.com | keepITcool chello nl | amsterdam
    >
    >
    > Snake Plissken wrote :
    >
    > > sub created_makro()
    > >
    > > 'bla bla
    > >
    > > end sub
    > >
    > >
    > > sub other_macro()
    > >
    > > call created_makro
    > >
    > > end sub
    > >
    > >
    > > is that what u looking for?
    > >
    > > > After I created a macro, how do I run this macro in code ?
    > > >
    > > >




  6. #6
    keepITcool
    Guest

    Re: How to run a macro in code


    i think you are a recent visitor to this newsgroup/forum
    and I also think you are just discovering excel
    IMO for the moment you should stick to formulas and functions...

    this NG is concerned with VBA/programming/macros.

    try a different group:
    try microsoft.public.excel.worksheetfunctions

    VanTheMan!!!

    --
    keepITcool
    | www.XLsupport.com | keepITcool chello nl | amsterdam


    Man Utd wrote :

    > Sorry for my lack of macro knowledge, I think macro is a sort of
    > function/procedure.
    > What I need to do is:
    > When I fill in the cell in worksheet A, eg. B3 has value "Peter", I
    > will call a macro/function/procedure to search through a range of
    > cells in worksheet B, eg. A2:D200, if I find the matched value in
    > column A is also "Peter", eg A10, then I need to fetch the values of
    > B10, C10, D10, fill in the worksheet A cells C3, D3, E3 from the
    > corresponding row in the worksheet B of the matched value.
    >
    > "keepITcool" <[email protected]> wrote in message
    > news:[email protected]...
    > >
    > > exactly the OP's point
    > >
    > > other_macro will give compile error
    > > if created_macro does not exist.
    > >
    > > use
    > > application.run thisworkbook.name & "!created_macro"
    > >
    > > make sure created_macro is not private.
    > >
    > >
    > > --
    > > keepITcool
    > > > www.XLsupport.com | keepITcool chello nl | amsterdam

    > >
    > >
    > > Snake Plissken wrote :
    > >
    > > > sub created_makro()
    > > >
    > > > 'bla bla
    > > >
    > > > end sub
    > > >
    > > >
    > > > sub other_macro()
    > > >
    > > > call created_makro
    > > >
    > > > end sub
    > > >
    > > >
    > > > is that what u looking for?
    > > >
    > > > > After I created a macro, how do I run this macro in code ?
    > > > >
    > > > >


+ 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