+ Reply to Thread
Results 1 to 3 of 3

Cell Value to refer to Variable

  1. #1
    Registered User
    Join Date
    04-07-2014
    Location
    Rugby, England
    MS-Off Ver
    2010
    Posts
    8

    Cell Value to refer to Variable

    Hi,

    I have declared 5 variables: Step1Names, Step2Names, Step3Names, Step4Names and Step5Names. If the cell value is 3 I would like to add the persons name to Step3Names. I tried to do this by writing

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer

    Please Login or Register  to view this content.
    but it didn't work.

    Any suggestions? As you can tell I'm a complete novice!
    Last edited by 6StringJazzer; 04-17-2014 at 07:18 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Cell Value to refer to Variable

    It's not clear what you're trying to do. You can't refer to a variable name by building up a string, if that's what you intend for that code to do. The expression on the left side of an "=" must be a variable or range reference, or other object type that you can assign a value to. In your code it's a string. Even if that string is "Step3Names" it won't be treated as the variable Step3Names. They are two different things.

    Please post all your code, and use code tags.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    04-07-2014
    Location
    Rugby, England
    MS-Off Ver
    2010
    Posts
    8

    Re: Cell Value to refer to Variable

    Thanks, I thought that might be the case so I'll try and use a select case.

    Thank you

+ 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. refer to cell in another workbook with variable sheet name
    By wonderdunder in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-15-2011, 04:23 AM
  2. How to refer to array variable in vba?
    By elcentro3m in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-06-2007, 02:21 PM
  3. how to refer to cell with variable in a formula?
    By seb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2006, 11:15 AM
  4. [SOLVED] Using a variable to refer a cell
    By jeam in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-13-2005, 12:06 PM
  5. Using a variable to refer to an optionbutton
    By PhilP in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-01-2005, 03:01 AM

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