+ Reply to Thread
Results 1 to 3 of 3

Change "Commandbutton" to a variable

  1. #1
    Registered User
    Join Date
    10-10-2016
    Location
    Québec
    MS-Off Ver
    2016
    Posts
    4

    Question Change "Commandbutton" to a variable

    Hi there, first post and I hope I'll be clear.

    In VBA, I know I can create a variable: Var01=sheets(name).range(name).value
    Then use it: sheets(othername).range(Var01).value

    Question: In my sub routine, I have a commandbutton, and I want to make its name variable. Possible? If yes, please, how?

    Ex. CommandbuttonName=sheets(name).range(name).value

    "CommandbuttonName".backcolor=(my color).

    Thank in advance

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    18,926

    Re: Change "Commandbutton" to a variable

    Where is the command button located and how did you create it?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    10-10-2016
    Location
    Québec
    MS-Off Ver
    2016
    Posts
    4

    Re: Change "Commandbutton" to a variable

    Commandbutton is in a Userform created with toolbox.
    In this Userform I have a 100 commandbutton, managing parking lot.
    Last edited by amipierre; 10-10-2016 at 10:37 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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