Automating the summing of columns

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

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,

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
 
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





.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top