ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automating the summing of columns (https://www.excelbanter.com/excel-programming/311571-automating-summing-columns.html)

steve

Automating the summing of columns
 
I have a spreadsheet which I send out each month. The
spreadsheet varies in length from one month to another.

Before I send it out, I sum the data in Columns A, C & E
and place the totals at the bottom of the corresponding
columns. Is it possible to get a macro to do this bearing
in mind that there is likely to be a differing number of
rows each week. If so, is it possible to bold and
underline the totals also ?

Many thanks

Chip Pearson

Automating the summing of columns
 
Steve,

Try some code like the following. Repeat for columns C and E.

Dim Rng As Range
Set Rng = Range("A1").End(xlDown)(2, 1)
Rng.Formula = "=SUM(A1:" & Rng(0, 1).Address(False, False) & ")"
Rng.Font.Bold = True
Rng.Font.Underline = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Steve" wrote in message
...
I have a spreadsheet which I send out each month. The
spreadsheet varies in length from one month to another.

Before I send it out, I sum the data in Columns A, C & E
and place the totals at the bottom of the corresponding
columns. Is it possible to get a macro to do this bearing
in mind that there is likely to be a differing number of
rows each week. If so, is it possible to bold and
underline the totals also ?

Many thanks




steve

Automating the summing of columns
 
Thank you Chip
-----Original Message-----
Steve,

Try some code like the following. Repeat for columns C

and E.

Dim Rng As Range
Set Rng = Range("A1").End(xlDown)(2, 1)
Rng.Formula = "=SUM(A1:" & Rng(0, 1).Address(False,

False) & ")"
Rng.Font.Bold = True
Rng.Font.Underline = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Steve" wrote in

message
...
I have a spreadsheet which I send out each month. The
spreadsheet varies in length from one month to another.

Before I send it out, I sum the data in Columns A, C & E
and place the totals at the bottom of the corresponding
columns. Is it possible to get a macro to do this

bearing
in mind that there is likely to be a differing number of
rows each week. If so, is it possible to bold and
underline the totals also ?

Many thanks



.



All times are GMT +1. The time now is 07:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com