LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Help with Looping Code

WOW !!
Holy Moly!! It works a treat.
I'm gonna study this one.
Thanks again,
Jim

"Tom Ogilvy" wrote in message
:

Sorry, it should have been:

set rng = Columns("A").specialcells(xlConstants,xlNumbers)
for each ar in rng.Areas
set rng1 = ar.offset(ar.Rows.count).Resize(1,1)
rng1.Formula = "=Subtotal(9," & ar.Address(0,0) & ")"
Next

rather then xlBlanks. So you shouldn't need to do anyting but the above.

--
Regards,
Tom Ogilvy


"JimMay" wrote in message
news:cBVgg.40343$fG3.26390@dukeread09...

Thanks Tom; I'm on a roll...

Now that I can get (from immediate window):
? rng.Address
$A$3,$A$5,$A$11,$A$16,$A$18

How can I derive the variables --
(Where A2 is the starting point)
A3-A2 = 1 << number of rows to include in Subtotal)
A5-A3+1 = 1
A11-A5+1= 5
A16-A11+1 = 4
A18-A16+1 = 1

Appreciate all your help..
I'm getting there..
Jim


"Tom Ogilvy" wrote in message
:


The blank cells in column A are already the

Dim rng as Range, ar as Range, rng1 as Range
set rng = Columns("A").specialcells(xlBlanks)
for each ar in rng.Areas
set rng1 = ar.offset(ar.Rows.count).Resize(1,1)
rng1.Formula = "=Subtotal(9," & ar.Address(0,0) & ")"
Next


--
Regards,
Tom Ogilvy



"JimMay" wrote in message
news:cILgg.40329$fG3.21866@dukeread09...


I have a couple hundred lines of Check Amts and Check Numbers (as


text)

like below..
I need to Loop from bottom to top and Sum the previous amts applicable
to
The same check number. Bottom line ColA should = 12660; 2 rows up
should = 1,583.96, etc up to Row 2.
Can someone get me started?
TIA,

ColA ColB
197.11 65704
65704
78.03 65705
65705
27.85 65706
1691.84 65706
122.98 65706
2275.13 65706
289.95 65706
65706
372.22 65707
57.96 65707
921.05 65707
232.73 65707
65707
12660 65709
65709




 
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
stopping code from looping tjb Excel Worksheet Functions 3 December 7th 05 02:02 AM
(1) VARIABLE IN POSTING CODE (2) LOOPING Robert Excel Programming 2 September 14th 05 06:31 AM
Looping macros using VB code accessuser1308 Excel Discussion (Misc queries) 2 March 9th 05 11:11 PM
Looping code in Excel macro Robert Excel Programming 2 February 25th 05 04:33 AM
Code looping when it should not Todd Huttenstine Excel Programming 3 May 13th 04 09:37 PM


All times are GMT +1. The time now is 01:57 AM.

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"