+ Reply to Thread
Results 1 to 2 of 2

Evaluating a string that represents a variable name

Hybrid View

  1. #1
    Registered User
    Join Date
    11-11-2011
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    1

    Question Evaluating a string that represents a variable name

    Dim color_positive as integer
    
    color_positive=36  'Light green
    Range("a1")="color_positive"
    I would like to set the background color of a cell to the value of the variable whose name is in range("a1")

    However, neither of the following seem to work.

    range("b1").interior.colorindex=range("a1") 
    
    range("b1")interior.colorindex=evaluate(range("a1"))
    Last edited by geko63; 11-12-2011 at 11:03 AM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Evaluating a string that represents a variable name

    Welcome to the forum, geko.

    Please take a few minutes to read the forum rules, and then edit your post to add CODE tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

+ 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