Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default SubTotal when Cell Changes

In my query I would like to have column J (Rentable Square Feet) insert a
subtotal when Owner Entity in Column C changes.

Column C Column J

Owner Entity Rentable Sq Ft
Company A 62,153
Company A 29,951
Company B 125,515
Company B 20,000

Company C 15,81
Company D 103,500
Company D 174,906

I would appreciate any assistance you can give me. Thx.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default SubTotal when Cell Changes

The below macro will insert a row and assign the subtotal in Col J. Col C
should not have any blanks...

Sub Macro1()
Dim lngRow As Long, lngTemp As Long

lngRow = 3
lngTemp = lngRow - 1

Do While Range("C" & lngRow) < ""
If Range("C" & lngRow) < Range("C" & lngRow - 1) Then
Rows(lngRow).Insert
Range("J" & lngRow) = "=sum(J" & lngTemp & ":J" & lngRow - 1 & ")"
lngRow = lngRow + 1: lngTemp = lngRow
End If
lngRow = lngRow + 1
Loop
Range("J" & lngRow) = "=sum(J" & lngTemp & ":J" & lngRow - 1 & ")"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"KalliKay" wrote:

In my query I would like to have column J (Rentable Square Feet) insert a
subtotal when Owner Entity in Column C changes.

Column C Column J

Owner Entity Rentable Sq Ft
Company A 62,153
Company A 29,951
Company B 125,515
Company B 20,000

Company C 15,81
Company D 103,500
Company D 174,906

I would appreciate any assistance you can give me. Thx.

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
Subtotal To Include Item Description On Subtotal Line Tickfarmer Excel Discussion (Misc queries) 2 February 23rd 10 07:56 PM
pasting to subtotal lines without replacing hidden -non-subtotal l harleydiva67 Excel Discussion (Misc queries) 1 October 12th 06 06:02 PM
Bolding the subtotal lines automaticlly When using the Subtotal fu 06Speed6 New Users to Excel 2 October 5th 06 03:52 PM
Subtotal of Subtotal displays Grand Total in wrong row Thomas Born Excel Worksheet Functions 5 January 6th 05 01:46 PM
Sort, Subtotal, Label Subtotal, Insert row Teak Excel Programming 2 April 8th 04 04:14 PM


All times are GMT +1. The time now is 10:04 AM.

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"