View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
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.