Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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.




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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!
Reply
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
Subtotals problem: Excel 2003 (not, AFAIK, the nested subtotals bug) AndyCotgreave Excel Discussion (Misc queries) 3 October 24th 07 11:32 AM
Original subtotals should not be within nested subtotals in excel Mirage Excel Worksheet Functions 1 June 6th 07 01:37 AM
Subtotals: Nested subtotals below higher subtotal RobN Excel Discussion (Misc queries) 1 July 20th 06 09:04 PM
Problem with nested subtotals, placing secondary subtotals BELOW . Dawn Cameron Excel Discussion (Misc queries) 1 June 3rd 05 10:13 PM
why are nested subtotals coming out below outer subtotals? Hendy Excel Worksheet Functions 2 January 18th 05 08:09 PM


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

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

About Us

"It's about Microsoft Excel"