none
Is any way to shorten this RRS feed

  • Question

  • Is any way to shorten this

        total1 = 0
        totalsum1 = 0
        totallart = 0
        totallartsum = 0
        totallartsumA = 0
        totallartsumB = 0
        totallartsumC = 0
        totallartsumD = 0


    Vforum

    Friday, November 8, 2019 8:04 AM

Answers

  • Hi Kosta,

    An Array is a kind of collection, where the same or similar data is stored in each element (like a box).
    e.g. in my sample, you can store total1 in aryCnt(0)totalsum1 in aryCnt(1)...
    aryCnt(9) is the 10th element in aryCnt, because an element index begins with zero in an array.

    Please google for "Excel VBA array", and you will find better and more detailed explanation about array of Excel.

    Regards, 

    Ashidacchi -- http://hokusosha.com

    • Marked as answer by Kosta si Friday, November 8, 2019 10:59 AM
    Friday, November 8, 2019 10:34 AM

All replies

  • Hi Kosta,

    I suppose "total1", "totalsum1" ... "totallartsumD" is a variable.
    If it is correct, you can use an Array like this.
    Dim aryCnt(9) as integer
    dim idx as integer
    For idx = 0 to 9
        aryCnt(idx) = 0
    Next

    Regards,

    Ashidacchi -- http://hokusosha.com

    Friday, November 8, 2019 8:44 AM
  • i am sorry i need to clear all those arrays at once

    I am trying to figure out your suggestion 

     i do not see where "total1,totalsum1...…" getting cleared I guess I am tired is late it's 4:43 AM hear

    Vforum

    Friday, November 8, 2019 9:45 AM
  • Hi Kosta,

    An Array is a kind of collection, where the same or similar data is stored in each element (like a box).
    e.g. in my sample, you can store total1 in aryCnt(0)totalsum1 in aryCnt(1)...
    aryCnt(9) is the 10th element in aryCnt, because an element index begins with zero in an array.

    Please google for "Excel VBA array", and you will find better and more detailed explanation about array of Excel.

    Regards, 

    Ashidacchi -- http://hokusosha.com

    • Marked as answer by Kosta si Friday, November 8, 2019 10:59 AM
    Friday, November 8, 2019 10:34 AM
  • got it 

    as usual 

    thank you

    Kosta


    Vforum

    Friday, November 8, 2019 10:59 AM