none
Trying to loop through rows and add the values, sum NOT showing up in target cells RRS feed

  • Question

  • Code

    With Worksheets("HiPO Input file")
        For x = 5 To x = 30 Step 1
            Set addRange1 = .Range(.Cells(x, 4), .Cells(x, myCount2))
            cell(x, myCount2 + 2).Value = Application.Sum(addRange1)
        Next
    End With

    Not sure why it isn't working

    Wednesday, February 22, 2017 10:59 AM

All replies

  • For x = 5 To x = 30 Step 1

    should be

    For x = 5 To 30

    because the original is equivalent to

    For x = 5 to False Step 1

    since x = 30 is evaluated as a comparison.

    cell(x, myCount2 + 2)

    should be

    .Cells(x, myCount2 + 2)

    Note the . before Cells


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Wednesday, February 22, 2017 3:27 PM