Thread: Sum
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default Sum


Can you work with this?

Option Explicit
Sub dynamicsumming()
Dim lastrow As Long
Dim ws As Worksheet

Set ws = Worksheets("Movies")
lastrow = Cells(Rows.Count, "I").End(xlUp).Row
Range("G1") = "=sum(I1:I" & lastrow & ")"
End Sub

HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Bishop" wrote:

I'm trying to sum all the values in a column and assign it to a variable.
This what I tried:

With Worksheets("Movies")

Paid = .Sum("I:I")

but Sum apparently doesn't take column references. Is there a way around
this?