+ Reply to Thread
Results 1 to 2 of 2

VB Code to assign Macro Button to certain Code

Hybrid View

rizmomin VB Code to assign Macro... 03-11-2016, 05:08 PM
sysss Re: VB Code to assign Macro... 03-11-2016, 05:36 PM
  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    VB Code to assign Macro Button to certain Code

    Hello:

    Please refer to attached file.
    I have created Button to Press.
    I need VB code so that when i press the Button, it will run the VB Code which is Cell G2.
    In this case it needs to run Sub Clear in Personal.XLSB
    Let me know if you have any questions.
    Thanks.

    Riz
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    12-14-2012
    Location
    Czech Republic
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: VB Code to assign Macro Button to certain Code

    Hi,

    not sure if I understood well.

    Try following..

    This to Personal.xlsb and its module:
    Sub Clear()
    With ActiveSheet
    .Range("G2").Interior.ColorIndex = 3
    End With
    End Sub
    And this to MacroButtons.xls module:
    Sub Button1_Click()
    Run ActiveSheet.Range("G2").Value
    End Sub
    Is this what you want?

    Regards,
    sysss

+ 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. Macro to Create Button and assign code
    By swatsp0p in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-06-2014, 12:21 PM
  2. [SOLVED] Please help! macro code needed to assign to command button to check a column of checkboxes
    By cnbv in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-22-2013, 04:47 AM
  3. Assign a macro to a button via VBA code
    By AverageCanadian in forum Excel General
    Replies: 3
    Last Post: 03-09-2012, 11:09 AM
  4. Macro to create Command Button and assign code
    By dagindi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-07-2011, 09:19 AM
  5. Replies: 6
    Last Post: 12-23-2009, 02:28 PM
  6. How do I assign a code to a button
    By Stevesmith in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 08-26-2007, 11:48 AM
  7. How to create a command button and assign code to it using VBA?
    By surotkin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-04-2007, 10:05 PM

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