leezac

asked on

# Formula not stopping at end of populated row

the line for total.formula is entering a sum in ALL of the rows in the column - not just the one with a value. I need for it to just populate the row with a value in A2. Can someone help please.

Application.Calculation = xlCalculationManual

Set r = Sheet19.Range("A2:D2")

Set headr = Sheet19.Range("A2:D2")

Set dest = Worksheets("Exceptions").Range("A2")

Set total = Sheet19.Range("A2")

Set total = Range(total, total.End(xlDown)).Offset(0, 4)

total.Formula = "=sum(B2:D2)"

Application.Calculation = xlCalculationManual

Set r = Sheet19.Range("A2:D2")

Set headr = Sheet19.Range("A2:D2")

Set dest = Worksheets("Exceptions").R

Set total = Sheet19.Range("A2")

Set total = Range(total, total.End(xlDown)).Offset(

total.Formula = "=sum(B2:D2)"

upload your worksheet plz

SOLUTION

membership

Create a free account to see this answer

Signing up is free and takes 30 seconds.

**No credit card required.**ASKER CERTIFIED SOLUTION

membership

Create a free account to see this answer

Signing up is free and takes 30 seconds.

**No credit card required.**ASKER

I just need the formula to go into D2 to end of used row of A for the Emp_tmp sheet.

With Sheets("Emp_tmp")

With .Range("D2:D" & .Cells(.Rows.Count, "A").End(xlUp).Row)

.Formula = "=sum(B2:D2)"

With Sheets("Emp_tmp")

With .Range("D2:D" & .Cells(.Rows.Count, "A").End(xlUp).Row)

.Formula = "=sum(B2:D2)"