LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 24
Default Bold & add line after subtotal row

I searched messages and found the following code by Chuck from 10/6/06 and
would like to adapt it to my spreadsheet, but can't get it to work. I
changed lastrow = Range ("L" & Rows.Count).End(xlUP).Row from "L" to "G" as
this is the column where my totals are. Will someone please explain this
code, especially the InStr lines? Hopefully, if I understand it better maybe
I can figure out what I'm doing wrong the reason it won't work.

Sub AddRowSubTotalsAssignedTo()
Dim lastrow As Long
Dim r As Long
lastrow = Range("L" & Rows.Count).End(xlUp).Row '"L" is the column that
'contains the GrandTotal
For r = lastrow To 2 Step -1
If InStr(1, Cells(r, 3).Value, "Total") 0 Or _
InStr(1, Cells(r, 8).Value, "Total") 0 Or _
InStr(1, Cells(r, 12).Value, "Total") 0 Then
Range(Cells(r, 1), Cells(r, 30)).Font.Bold = True '30 is number
'of columns from "A" that the macro will BOLD
ActiveSheet.Rows(r + 1).EntireRow.Insert
End If
Next
End Sub

Any help is greatly appreicated!
Thanks,
Pam
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
would like each subtotal line highlighted sjs Excel Discussion (Misc queries) 2 March 29th 07 09:21 PM
Excel subtotal function- put subtotals in bold text EPMMGR06 Excel Discussion (Misc queries) 2 August 31st 06 05:47 PM
excel subtotal funtion how do you get the result in bold type? Avtarstew Excel Worksheet Functions 1 May 4th 06 01:30 PM
How do you add a blank line automatically after the Subtotal line MVSD Guy Excel Worksheet Functions 0 April 20th 06 01:04 AM
Subtotal line selection Jenny Excel Discussion (Misc queries) 1 April 13th 05 02:21 PM


All times are GMT +1. The time now is 12:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"