Thread: Macro help
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Macro help

Since you don't fully explain, I'm doing some guessing here. This will go
thru all worksheets after sheet1 and total c2:c last row and put the total
in c1

Sub totalvariablecolumn()
For i = 2 To Worksheets.Count
With Sheets(i)
lr = .Cells(rows.Count, "c").End(xlUp).Row
mysum = Application.Sum(.Range("c2:c" & lr))
'MsgBox mysum
..Cells(1, "c") = mysum
End With
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"igotquestions" wrote in message
...
I am trying to create a macro that will add the dollar values in a specific
column. The problem I am having is that the number of vaules in that
column
vary depending on the worksheet. Ex. Worksheet 1 has 20 dollar values
while
worksheet 2 has 60 dollar values.

How can I create a macro that will, autosense if you will, the number of
values in a specifc column and adjust the formula to meet the needs of
different spreadsheets?