View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
marcus[_3_] marcus[_3_] is offline
external usenet poster
 
Posts: 140
Default How to change this Ron deBruin Macro

Hi Kenny

I would have thought Set Rng = Range("H"&LastRow) will give you the
sum of the last unused row in Col H which will be zero as it won't
have anything in it.

Something like Set Rng = Range("H2:H"&LastRow)

will give you the range from H2 to the last row in that range.
Alternatively incorporate the followning which I had the chance to
test.

Take Care

Marcus


Sub testo()
Dim lw As Integer
lw = Range("H" & Rows.Count).End(xlUp).Row + 1
myRange = ActiveSheet.Range("H2", Range("H2").End(xlDown))
Range("H" & lw) = WorksheetFunction.Sum(myRange)
End Sub