Macro to sum columns in all sheets in a workbook

J

Jodie

I need to write a macro to sum the same columns (ie.. G:O) in every worksheet
within a workbook. I need to add it to a macro that I already have which
splits sheet 1 into other sheets using the information in column A. I have
that macro working as well as using an auto fit macro for all sheets, but now
I need to total the columns in each sheet that was created. I have a macro
that works when it is one sheet but I don't know how to do it for all
sheets. Also, the columns in each sheet will end in different rows.
 
J

Jodie

Hi Joel, I tried it and I am getting an error.

Compile error
Syntax error

It occurs at Set SumRange = .Range(.Cells(1, firstCol), .Cells(LastRow,
firstCol))

I should tell you that I am adding this to a module that I already have that
creates the sheets. What I have that already creates the sheets may creat a
sheet with only one row which is the header. There are 2 sheets created with
no records except the header. They are named NULL and PFSPLANID. I tried
deleting those sheets and rerunning, but I get the same error. Can you
please help me figure out what I am doing wrong?
 

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

Top