Insert A Blank Row Where A New Category Begins

geekette

Board Regular
Joined
Sep 12, 2006
Messages
120
I am trying to automate a spreadsheet. I've written code in VB to run an autofilter and copy and paste selected data into a new worksheet. I now need to insert subtotals in the new sheet where a name in a column changes.

So for example I have 5 rows of data where the source name = A. On the 6th row the source name = B. Inbetween these two rows I need to insert a subtotal to sum the data for source name A, and then continue down for source B, C, D etc...

Is this possible to do?

I will be so greatful for any help on this
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi, I have another question about subtotaling. I used the method above and have included it within a macro which is great. Next I want to colour each subtotaled section in a different colour. Currently I do this manually.

Ideally I need to the first subtotalled section dark blue, the next light blue and alternate this until there are no more subtotals. Is there anyway I can do this?
 
Upvote 0
You can use one color like this with conditional formatting.( Edit: Sorry this works only for "total" rows, and not the whole section. I didn't read you question right. )

If you have "Total" texts in column A put in A1 cell conditional formatting
with Formula is option

=ISNUMBER(FIND("Total",$A1,1))

and then select the color.

Then OK, OK.

Then copy your format to all cells

Pekka
:eek: :eek:
 
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,034
Members
448,940
Latest member
mdusw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top