+ Reply to Thread
Results 1 to 5 of 5

Defining a variable to select a button on a form

  1. #1
    Registered User
    Join Date
    03-02-2013
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    11

    Defining a variable to select a button on a form

    I have a form with several buttons. The button names have a common part distinguished by a number in the name. I what to write a loop that selects button1 and changes the caption of the button and proceeds through button(n). Can anyone help me define a variable that can be used within a loop that can be used as the name of the button to change the features of the button ?

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Defining a variable to select a button on a form

    Hello markusjbear,

    Welcome to the Forum!

    You should post a copy of your workbook. This will provide all the information needed to develop and test any solutions.

    To Post Your Workbook
    1. At the bottom right of the Reply window, Click the button Go Advanced
    2. At the top of the Your Message Window, in the first row of icons, Click the Paperclip icon.
    3. Click the Add Files button at the top right in the dialog box. This displays the File Manager dialog.
    4. Click the Select Files button at the bottom middle of the dialog.
    5. In the new window Find the file you want to upload, select it, and Click Open.
    6. You will now be back in the File Manager dialog. Click the bottom Middle button Upload File.
    7. Wait until the file has completely uploaded before you exit the File Manager dialog.

    File Manger Picture
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    03-02-2013
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Defining a variable to select a button on a form

    Calander, 130228.xlsm

    Thanks for your help. I hope I added the file correctly.

    Basically, I am recreating the calendar function and I have 42 buttons (7 X 6). I would like to access them in a loop to set the caption of the day value. Can i make a variable that references the button and make a loop as follows?
    Please Login or Register  to view this content.
    thanks
    Last edited by Leith Ross; 03-08-2013 at 05:45 PM. Reason: Added Code Tags

  4. #4
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Defining a variable to select a button on a form

    Hi markusjbear,
    try this
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-02-2013
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    11

    Smile Re: Defining a variable to select a button on a form

    Thank you very much. This did the trick.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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