Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
would like each subtotal line highlighted | Excel Discussion (Misc queries) | |||
Excel subtotal function- put subtotals in bold text | Excel Discussion (Misc queries) | |||
excel subtotal funtion how do you get the result in bold type? | Excel Worksheet Functions | |||
How do you add a blank line automatically after the Subtotal line | Excel Worksheet Functions | |||
Subtotal line selection | Excel Discussion (Misc queries) |