+ 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
    19,643

    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)

Similar Threads

  1. Copy formatting up to certain column (variable) to avoid "cannot change array" error
    By lorikgator in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-03-2015, 10:28 AM
  2. [SOLVED] How to add variable to change row in Solvers "ByChange"
    By drrazor in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-03-2014, 05:40 AM
  3. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  4. [SOLVED] Variable "sheet-name" and "range-name" wanted in INDEX/MATCH-function
    By Fiebuls in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-01-2012, 04:09 PM
  5. Error msgs: "Object varible or with block variable not set"; "subscript out of range"
    By menyanthe in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-26-2009, 04:58 PM
  6. Replies: 3
    Last Post: 07-27-2008, 06:31 AM
  7. use variable in Workbooks("book1").Worksheets("sheet1").Range("a1"
    By Luc in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-28-2005, 04: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