+ Reply to Thread
Results 1 to 3 of 3

help with making a dynamic variable

Hybrid View

  1. #1
    Registered User
    Join Date
    09-30-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    19

    help with making a dynamic variable

    I am trying to make a variable that changes depending on what the user chooses.

    i want it to add items to the list and take items away from the list as necessary.

    here is the code i am using but it doesn't work.

    dim list as string
    
    list = list & item
    ' this works to add items to the list....but to take them off i use
    
    list = list - item
    'but this doesn't work.  is there something i am missing here.  shouldn't it be that simple to make a dynamic list such as this?
    thanx for any help you can give me
    angel.
    Last edited by squeekee35; 10-03-2011 at 11:04 AM. Reason: solved

  2. #2
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: help with making a dynamic variable

    Your problem is that you are trying to manipulate a string as if it were a number.

    list = list & item
    The & is not the same as +. & concatenates the two strings. So

    "Test," & "Test 2" = "Test,Test 2"

    "Test,Test 2" - "Test 2" just doesn't make any sense, mathmatically. You need to use Replace()

    List = Replace(List, item, "")
    This replaces one string of text with another. In this case, you are replacing a string of text with an empty string.

  3. #3
    Registered User
    Join Date
    09-30-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: help with making a dynamic variable

    thank you for your help this worked.
    Last edited by squeekee35; 10-03-2011 at 11:03 AM. Reason: solved

+ 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