+ Reply to Thread
Results 1 to 6 of 6

VBA code for a command button

  1. #1
    Registered User
    Join Date
    07-25-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    2010
    Posts
    17

    VBA code for a command button

    Hi.

    Please help me.

    I need the VBA code for a command button.
    This button I want to open a sheet, in a dynamic mode, considering a value from a cell.
    I've attached a workbook.
    Thank you.
    Attached Files Attached Files

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

    Re: VBA code for a command button

    If you assign this macro to the button, it should do what you want
    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.

  3. #3
    Registered User
    Join Date
    07-25-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    2010
    Posts
    17

    Re: VBA code for a command button

    Thank you. It works!!! You made me happy.

    May I have another question?
    Please see the sheet A1.
    There is another Command button that it should make three commands:
    - Save doc
    - Go to Main Sheet
    - Clear contents for cells B5 and D5

    Thanks!!!
    Attached Files Attached Files

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

    Re: VBA code for a command button

    You can record macros to find the syntax for all of those operations.
    And then assign then to the buttons. You, and your users, might prefer three command buttons to one.

  5. #5
    Registered User
    Join Date
    07-25-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    2010
    Posts
    17

    Re: VBA code for a command button

    I have already done. It works perfectly.
    Thank you a lot.

  6. #6
    Registered User
    Join Date
    07-25-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    2010
    Posts
    17

    Re: VBA code for a command button

    Hi.

    Another question I have for you.
    I attached an Excel file.
    There is a sheet named Main and three sheet named Sheet2, Sheet3 and Sheet4.
    In cell B2 in Main sheet I can made a selection, I mean about the names of Sheet2, 3 or 4.
    I wish the Main be permanently visible and Sheet2, 3 and 4 be permanently hiden.
    I need a VBA code that should make next: if I select in B2 Sheet2, the code should unhide the Sheet2 and open it, and the same with the Sheet3 and Sheet4.
    Thanks.
    Attached Files Attached Files
    Last edited by zvonacfirst; 12-11-2016 at 07:28 AM.

+ 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. VBA code to create command button. Print all sheets then delete command button.
    By Declamatory in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-15-2015, 05:18 PM
  2. [SOLVED] Run Command Prompt Icacls code in VBA Command Button on Userform
    By luismalave in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2015, 11:40 PM
  3. Create a command button with code with a command button
    By jakara in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2013, 01:28 PM
  4. Code for a master command button to change the backcolor of multiple command buttons?
    By panttherm5 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-16-2012, 10:11 PM
  5. [SOLVED] vba code, command bar, command bar button, one button works but not two
    By amazingg64 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2012, 09:55 AM
  6. Trying to Give New Command Button Code from Another Sheet's Code
    By MegaRush in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-10-2012, 09:43 AM
  7. Command Button Code
    By chedges in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-12-2009, 12:17 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