LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default A MACRO ON SUBTOTAL

I am attempting to do a subtotal based column A without invoking the
subtotal function. Pls review the code below and correct the msitakes.



Dim z As Long
Dim TOT As String
z = 3
Range("C2").FormulaR1C1 = "=RC[-1]"
TOT = Range("C2").Value

Do While Range("A" & z) < ""

If Range("A" & z).Value = Range("A" & z - 1).Value Then

'Range("C" & z - 1).FormulaR1C1 = "=RC[-1]+R[-1]C"

Range("C" & z).Select
ActiveCell.FormulaR1C1 = "=RC[-1]+ TOT"

TOT = "=RC[-1]" + TOT
Range("C" & z - 1).FormulaR1C1 = 0

Else
Range("A" & z).Select
ActiveCell.FormulaR1C1 = 0

End If
z = z + 1
Loop

 
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
sort macro, subtotal and add lines after subtotal David Excel Discussion (Misc queries) 1 August 29th 09 10:56 AM
Macro add row and subtotal simplymidori[_2_] Excel Discussion (Misc queries) 0 April 30th 08 12:34 AM
macro excel subtotal in subtotal GBO Excel Discussion (Misc queries) 2 November 29th 07 02:15 PM
Subtotal Macro [email protected] Excel Worksheet Functions 1 January 26th 05 11:13 AM
Subtotal Format with Macro Juan Excel Programming 1 April 2nd 04 09:51 AM


All times are GMT +1. The time now is 12:18 PM.

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

About Us

"It's about Microsoft Excel"