Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to auto sum
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to auto sum
Thanks, Charles!
childofthe1980s "Charles Chickering" wrote: 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to auto sum
Hi Charles,
I tried this with something I'm working on and it worked great, but I also need to delete any blank rows I have before the auto sum takes place. What can I add to this code to delete the blank rows? Thanks "Charles Chickering" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sub Macro vrs Function Macro Auto Start | Excel Discussion (Misc queries) | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
Auto-run macro after auto-query refresh (Excel2000,sr1) | Excel Programming | |||
Auto macro | Excel Programming | |||
auto run a macro | Excel Programming |