+ Reply to Thread
Results 1 to 15 of 15

excel button

  1. #1
    Registered User
    Join Date
    09-07-2019
    Location
    greece
    MS-Off Ver
    2010
    Posts
    49

    excel button

    hi guys, i would like to make two buttons, one at B1 and the second at C1. if you press B1 button must show number 1 at A1 or if you press C1 button should show 2 at A1.
    The second issue is that i would like to have these buttons in columns because am interesting to have data in A1:A30.
    thanks so much!

  2. #2
    Registered User
    Join Date
    09-07-2019
    Location
    greece
    MS-Off Ver
    2010
    Posts
    49

    Re: excel button

    is my question clear?

  3. #3
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: excel button

    Create your buttons and assign the code below to each...
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    09-07-2019
    Location
    greece
    MS-Off Ver
    2010
    Posts
    49

    Re: excel button

    thanks, the thing is that i dont know how to create a button

  5. #5
    Registered User
    Join Date
    09-07-2019
    Location
    greece
    MS-Off Ver
    2010
    Posts
    49

    Re: excel button

    sorry i cant work it out.. i try to put code
    Sub Button1()
    Range "A1" = 1
    End Sub
    but it does not work
    Attached Files Attached Files

  6. #6
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,737

    Re: excel button

    Quote Originally Posted by sakis777 View Post
    sorry i cant work it out.. i try to put code
    Sub Button1()
    Range("A1") = 1
    End Sub
    but it does not work
    check attached file. Buttons already in and macros assigned.
    Attached Files Attached Files
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  7. #7
    Registered User
    Join Date
    09-07-2019
    Location
    greece
    MS-Off Ver
    2010
    Posts
    49

    Re: excel button

    thanks Kokosek!, can you explain me how to make more 2 buttons( at B2, C2) to do the same job at A2

  8. #8
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Re: excel button

    Good afternoon sakis777

    First, write your code using the code given by dangelor / KOKOSEK as a template.

    Then, go to Deveoper > Insert and choose the button icon (top left) under Form Controls, draw your button, then choose which macro to assign it to.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  9. #9
    Registered User
    Join Date
    09-07-2019
    Location
    greece
    MS-Off Ver
    2010
    Posts
    49

    Re: excel button

    ok super!,and the last question on that is how can i put in the code to change values 1,2 at A1:A30?,is it possible?

  10. #10
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: excel button

    ...and for information any picture, shape, clip art object (see Insert Ribbon menu Illustrations pane) can be used as a clickable button and assigned to a macro.
    This give you a lot more flexibility than just a rectangular forms button.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  11. #11
    Registered User
    Join Date
    09-07-2019
    Location
    greece
    MS-Off Ver
    2010
    Posts
    49

    Re: excel button

    i try to make the button but i get a message: compile error :invalid ude of property,why??

  12. #12
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,737

    Re: excel button

    Do you need 60 buttons in total? (2 for each row in A1:A30)?

  13. #13
    Registered User
    Join Date
    09-07-2019
    Location
    greece
    MS-Off Ver
    2010
    Posts
    49

    Re: excel button

    yes Koko! but the thing i also wanted is to know how to do it by myself,i try to make the button but i get a message: compile error :invalid use of property,can u please explain me the process of two buttons once again.God bless You!!
    Attached Files Attached Files
    Last edited by sakis777; 09-17-2019 at 10:39 AM.

  14. #14
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Re: excel button

    Hi sakis777

    Don't worry - it's a syntax thing, which you'll soon get used to.

    Use code following this structure :
    Please Login or Register  to view this content.
    HTH

    DominicB

  15. #15
    Registered User
    Join Date
    09-07-2019
    Location
    greece
    MS-Off Ver
    2010
    Posts
    49

    Re: excel button

    iam not sure if its working

+ 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] How to insert Previous, Next Button & Print Record Button in excel???
    By vijubhau in forum Excel General
    Replies: 3
    Last Post: 10-24-2018, 07:01 AM
  2. EXCEL -- Button for new row relative to button location
    By cpierzc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-10-2018, 01:09 AM
  3. Button to open up existing excel file in another sheet in current excel workbook
    By bearcats667 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-29-2018, 02:58 PM
  4. Replies: 1
    Last Post: 02-27-2017, 09:17 AM
  5. [SOLVED] Form - select button & retrieve button name or button's caption
    By lexusap in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-27-2016, 12:28 AM
  6. vba code to disable only close button and close through a button in Excel workbook
    By atif_ar in forum Excel Programming / VBA / Macros
    Replies: 47
    Last Post: 11-23-2014, 02:41 PM
  7. VBA Code to Disable Excel Close button also disabling my Close Button
    By akynyemi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-28-2013, 12:56 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