+ Reply to Thread
Results 1 to 5 of 5

What is the name property of a command button on a worksheet

  1. #1
    Registered User
    Join Date
    10-29-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2007
    Posts
    12

    What is the name property of a command button on a worksheet

    I've inserted a Command Button (activeX control) to a worksheet. I want to modify its caption using vba code. How do I determine the name property of the button so that I can refer to it in the code?

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: What is the name property of a command button on a worksheet

    Please Login or Register  to view this content.

    e/ In design mode, if you right click the button and go to properties it will show you the button's name.
    Last edited by Solus Rankin; 04-03-2014 at 03:43 PM.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Registered User
    Join Date
    10-29-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: What is the name property of a command button on a worksheet

    Thanks! What about the same question, except wanting to use vba code to modify the caption of a Button (Form Control)?

  4. #4
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: What is the name property of a command button on a worksheet

    Please Login or Register  to view this content.
    The name of the button can be found in the name box (to the left of the formula bar) when the button is selected.

  5. #5
    Registered User
    Join Date
    10-29-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: What is the name property of a command button on a worksheet

    Thanks again!

    I changed the Sheets("Sheet1") to ActiveSheet and it worked. When I tried it exactly as recommended, I got an error...
    Run-time error '9':

    Subscript out of range
    Don't know why I got the error since the button is on Sheet1 - but oh well. It works now!

+ 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. Command Button Property
    By BS Singh in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-05-2013, 06:28 PM
  2. Email worksheet via command button
    By KaFi in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-27-2010, 11:50 PM
  3. Populate Worksheet with Command Button
    By taichi56 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-23-2008, 09:06 PM
  4. Command Button on worksheet
    By Jack in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-12-2006, 06:55 AM
  5. [SOLVED] command button on worksheet
    By PhilC in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-19-2006, 12:15 PM

Tags for this Thread

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