+ Reply to Thread
Results 1 to 4 of 4

Add command button to sheet

  1. #1
    Registered User
    Join Date
    02-15-2006
    Posts
    93

    Add command button to sheet

    Good evening,

    I was wondering if it is possible to add a command button to a worksheet using vba and to assign what action it is to take (i.e. call a sub routine) after it has been created.

    What I am trying to do is have a macro extract the relevant information for a particular user and set it up on a new sheet allowing them to edit it. Once they have edited it, I want the newly inserted command button to call some code to transfer the information back to the main table.

    Any ideas?
    Thanks in advance
    tc

  2. #2
    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: Add command button to sheet

    Try recording a macro of inserting a button from the forms toolbar (or an AutoShape from the Drawing toolbar) and assigning a macro to it. You can edit from there.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    02-15-2006
    Posts
    93

    Re: Add command button to sheet

    Thanks,

    I have the code figured out how to insert the command button but I still don't know how to assign a macro to it using vba. Any ideas?

    tc

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Add command button to sheet

    You need to set its OnAction property to the name of the macro (assuming you used a control from the Forms toolbar)
    Remember what the dormouse said
    Feed your head

+ 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