Search for subtotals
I wld like to start at cell D3. Then search for any subtotals downwards.
If found, say cell D15, outline the upper border (ie btw D14 & D15), and insert a line below D15 (I find this difficult becos inserted line is always above, not below) This should continue until end of data rows. Thanks. |
Search for subtotals
Hi
try the following macro. It tests column A and inserts a blank row if the word 'subtotal' is found Sub insert_rows() Dim lastrow As Long Dim row_index As Long lastrow = ActiveSheet.Cells(Rows.count, "A").End(xlUp).row For row_index = lastrow - 1 To 1 Step -1 If InStr(Cells(row_index, "A").Value,"Subtotal")0 then Cells(row_index + 1, "A").EntireRow.Insert (xlShiftDown) End If Next End Sub -- Regards Frank Kabel Frankfurt, Germany Teak wrote: I wld like to start at cell D3. Then search for any subtotals downwards. If found, say cell D15, outline the upper border (ie btw D14 & D15), and insert a line below D15 (I find this difficult becos inserted line is always above, not below) This should continue until end of data rows. Thanks. |
Search for subtotals
Thanks Frank. Will try out the macro.
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
All times are GMT +1. The time now is 04:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com