ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Dedrie, FORMATTING SUBTOTALS (https://www.excelbanter.com/excel-worksheet-functions/41213-dedrie-formatting-subtotals.html)

Robert

Dedrie, FORMATTING SUBTOTALS
 
In response to your recent query, Ron de Bruins following code will definately
help you.

-- Alt-F11 to open the VBA editor
Insert module from the menubar
Paste the sub
Alt-Q to go back to excel

Alt-F8
Select test
Run

Sub test()
Dim Rng As Range
Dim findstring As String
findstring = "subtotal"
Set Rng = Range("A:A").Find(What:=findstring, After:=Range("A" & Rows.Count), LookAt:=xlPart)
While Not Rng Is Nothing
'Rng.EntireRow.Cells.Font.Bold = True
Rng.EntireRow.Insert
Set Rng = Range("A" & Rng.Row + 1 & ":A" & Rows.Count) _
.Find(What:=findstring, After:=Range("A" & Rows.Count), LookAt:=xlPart)
Wend
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


Robert


All times are GMT +1. The time now is 04:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com