+ Reply to Thread
Results 1 to 14 of 14

Create Command Button

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

    Create Command Button

    Hello:

    Please refer to attached file.
    I have store names in Column B as shown.
    I need Vb code to create command button in cell C3,C4 and C5 so that if i press any of the button then it will
    give cell D1 the name of the correspoding store name.
    Example:

    If I press the button in Cell C3 then D1 = Store1
    If I press the button in Cell C4 then D1 = Store2
    If I press the button in Cell C5 then D1 = Store3

    Let me know if you have any questions.
    Thanks.
    RM
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Create Command Button

    Hi rizmomin, here's a quick alternative using Buttons (Form Control) and linking them to one (public) Macro:
    Please Login or Register  to view this content.
    See if that works for you.

    Cheers,
    berlan

  3. #3
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Create Command Button

    Hi rizmomin,

    Refer attached.

    Regards,

    Robert
    Attached Files Attached Files
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

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

    Re: Create Command Button

    Hi Guys:

    Both solution seems to work great, howver i will use Berlan as it creates the button also.
    Thanks a bunch to both, i will further test and let you know if any problem.
    RM

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

    Re: Create Command Button

    Hi Berlan or Trebor:

    Is it possible to name the buttons created in column the same as the names from Column B.
    Example Cell B3 is Store1 so the button created in cell c3 need a name as Store1 and so on.
    Please let me know if you have any questions.
    Thanks.

    RM

  6. #6
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Create Command Button

    Try this:

    Please Login or Register  to view this content.
    Regards,

    Robert

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

    Re: Create Command Button

    Hi Trrbor:

    Superb,.....Love it....Works great.
    May i ask one last thing.
    When i run "Sub CreateButtons" and run CreateButton again it creates layer of Buttons.
    Is there a way to code so that when i run Sub CreatButton, it deletes old buttons and create new one.
    This is not a biog issue but wonder why this is happening.
    Please let me know if you have any questions.
    Thanks.

    RM

  8. #8
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Create Command Button

    Hi Riz,

    It's always helpful to list all your requirements from the outset

    Try this:

    Please Login or Register  to view this content.
    Regards,

    Robert

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

    Re: Create Command Button

    Hi Trebor:

    Sorry to bother you.
    Please refer to attached file.
    I tried to create another column of buttons and this time wanted the output to go to Cell E1
    So basically, any button presses in column C needs to go to Cell D1 &
    any button presses in column D needs to go to Cell E1
    i tried but it is still going to cell C1 only.
    Let me know if you have any questions.
    Thanks.
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Create Command Button

    any button presses in column D needs to go to Cell E1
    So what column are you going to use for the names for the second set of buttons?

    i tried but it is still going to cell C1 only.
    When I click on any of the buttons in column E the adjacent text in column D goes to E1?
    Last edited by Trebor76; 10-11-2015 at 11:27 PM.

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

    Re: Create Command Button

    Hi Trebor:

    It seems to work now, not sure what i was doing wrong.
    But i really appreciate all the help i am getting and learning a lot from expert like you.
    I just want to say that i am not a programmer but i am able to adopt the code with my logic and help from this forum.
    Thanks a lot and will contact you further if needed.
    RM

  12. #12
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Create Command Button

    Thanks a lot and will contact you further if needed.
    No, please keep all requests open to the forum. Thanks.

    I'm glad we (berlin and I) got it sorted for you

    Robert

  13. #13
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Create Command Button

    Glad it worked -- and great modifications Robert!!!

    Could also compare with the topleftcelladdress in the DelButton script:

    Please Login or Register  to view this content.
    Cheers,
    Johan

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

    Re: Create Command Button

    Hi Berlan and Trebor:

    Thanks a lot to come up with great solution for me and some others i am sure are looking into this important tool to create Macro Buttons
    RM

+ 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] Command button to create a pdf
    By tjdarla in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-12-2013, 10:23 PM
  2. 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
  3. create a command button
    By mandyg23 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-27-2012, 05:14 PM
  4. create a command button for an add in
    By Blake 7 in forum The Water Cooler
    Replies: 3
    Last Post: 05-25-2011, 10:29 AM
  5. How to create command button and run from the ribbon?
    By Nelson Li in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-18-2009, 01:57 PM
  6. Create a Command Button
    By njg2982 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-27-2008, 08:04 PM
  7. How to Create a Command Button
    By Jason in forum Excel General
    Replies: 1
    Last Post: 10-12-2005, 05:05 PM
  8. [SOLVED] command button:. how can i create a command button
    By ashley in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 08-29-2005, 05: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