Link to home
Create AccountLog in
Avatar of leezac
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)"
Avatar of yahooooo
yahooooo
Flag of United Kingdom of Great Britain and Northern Ireland image

upload your worksheet plz
SOLUTION
Avatar of Gašper Kamenšek
Gašper Kamenšek
Flag of Slovenia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of leezac
leezac

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)"