EXCEL 2003 - SUBTOTALS

R

RCF

After using the subtotal command, I want to format the spreadsheet by
inserting blank lines before and after each subtotal and grand total. How
can I do this without manually inserting blank lines; or how can I create a
template with blank lines inserted after each subtotal?
 
G

Gord Dibben

Does this work for you?

Option Compare Text
Sub insert_rows()
Dim RowNdx As Long
Dim LastRow As Long
LastRow = ActiveSheet.UsedRange.Rows.Count
For RowNdx = LastRow To 1 Step -1
If Cells(RowNdx, "C").Value Like "*Total*" Then 'edit "C" to suit
Rows(RowNdx + 1).EntireRow.Insert
Rows(RowNdx).EntireRow.Insert
End If
Next RowNdx
End Sub


Gord Dibben MS Excel MVP
 

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

Similar Threads

Subtotals 1
Add new subtotal lines 1
Subtotal placement issue 2
Totaling Subtotals 2
Subtotals 2
Formatting Subtotals 1
Getting Text data using the Data - Subtotal feature 1
Conditional SUBTOTAL in XL210 Table 7

Top