+ Reply to Thread
Results 1 to 7 of 7

Assign Macro

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Assign Macro

    Hello:

    Please refer to attached file.
    I need VB code to assign the "Macro1" Button to run Macro which is in cell C1

    Let me know if you have any questions.
    Thanks.

    Riz
    Attached Files Attached Files

  2. #2
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Assign Macro

    If the button is a Forms object and assuming that the name of the macro is in cell C1 then
    Please Login or Register  to view this content.
    Change the sheetname to your needs.
    Cheers!
    Tsjallie




    --------
    If your problem is solved, pls mark the thread SOLVED (see Thread Tools in the menu above). Thank you!

    If you think design is an expensive waste of time, try doing without ...

  3. #3
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Assign Macro

    Hello Tsjallie:

    Thanks, it seems to work.
    However, i have few questions:
    How would i use above code if i have multiple sheet and all sheet will have macro location in Cell C1.
    Also in my all sheets, i have lots of macro assigned button so how would i know the name of the Button in above code.
    Please let me know if you have any questions.
    Thanks.

    Riz

  4. #4
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Assign Macro

    You could add this code to the codemodule of ThisWorkbook.
    But you should decide on a standard name for the button to assign the macro to.
    Or have the name of the button in an other cell.
    Please Login or Register  to view this content.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Assign Macro

    @riz: You're not expecting that to change dynamically when you change the name of the macro in the cell, correct?
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Assign Macro

    You could assign the button to this routine

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  7. #7
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Assign Macro

    Hello Guys:

    I am sure i will be able to use any of the code above to fit my requirement.
    Thanks a lot and will contact if further help is needed.

    Riz

+ 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] Hidden macro names from Assign Macro Window
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-02-2016, 08:17 PM
  2. [SOLVED] Using macro to create a Form Control Button and Assign macro to it in a specified Cell
    By weige1989 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-30-2014, 11:51 AM
  3. How to assign macro to buttons in another workbook where the source macro path not fixed?
    By rutikachavan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-18-2013, 04:32 AM
  4. Replies: 0
    Last Post: 01-15-2013, 08:18 PM
  5. Assign a macro to automatically find the last assigned other macro
    By tperkins1973 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-03-2012, 06:39 PM
  6. [SOLVED] Write and assign macro to newly created button using macro
    By tryingtolearn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-19-2012, 10:41 PM
  7. Replies: 2
    Last Post: 01-18-2008, 11:45 AM

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