+ Reply to Thread
Results 1 to 3 of 3

Odd behaviour when adding Variables

  1. #1
    Registered User
    Join Date
    06-27-2012
    Location
    Singapore
    MS-Off Ver
    excel 2011
    Posts
    4

    Odd behaviour when adding Variables

    Hi guys,

    I'm trying to add the variables "indv" and "ttl" throughout a loop.

    instead of summing the numbers i.e. 1+2=3, the macro simply adds them as strings i.e. 1+2=12.

    any idea what I'm doing wrong?

    here's my code

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Odd behaviour when adding Variables

    Hi

    The textbox is returning a string, not a value, so it is concatenating and not summing.

    try something like

    Please Login or Register  to view this content.
    rylo

  3. #3
    Registered User
    Join Date
    06-27-2012
    Location
    Singapore
    MS-Off Ver
    excel 2011
    Posts
    4

    Re: Odd behaviour when adding Variables

    Woohoo! Thanks it works now! :D

+ 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