View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Charles Chickering Charles Chickering is offline
external usenet poster
 
Posts: 272
Default macro to auto sum

Sub AutoSumForLazyUsers()
Range("A" & Rows.Count).End(xlUp).Offset(1).FormulaR1C1 = _
"=Sum(R1C:R[-1]C)" 'Change "A" to Your Column and 'R1C' to your first row
End Sub

--
Charles Chickering

"A good example is twice the value of good advice."


"childofthe1980s" wrote:

Hello:

Is it possible to create a macro in Excel that will sum up a column of data,
rather than having the end user press the AutoSum button? I know it sounds
"lazy" on the user's part, but there is a good reason.

The situation is that an external application is going to be exporting data
to Excel, and the application can use Excel macros perfectly. I want to
create a macro in Excel that will automatically sum up a column of data
immediately after the data is exported to Excel.

Now, the number of records in that column is not going to be the same
everytime. I mean, the number of records one time might be 30, the next time
it might be 40, etc.?

Is this all possible to do in a macro?

Thanks!

childofthe1980s