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: 3,885
Default Nested Loop

Hi
just as a question: Why not use the feature 'Data - Subtotals'

--
Regards
Frank Kabel
Frankfurt, Germany


Federico Ginnari wrote:
Hi, i'm stuck in a little project that i'm working on, the problem is
that i can't get my nested loop to work as i wanted, here is an
example of the information on the sheet, and below is an example of
my code.

Title
$$$$
$$$$
$$$$

$$$$
TOTAL
Title
$$$$
$$$$
$$$$

$$$$
TOTAL

lngTotalRows = Sheet1.UsedRange.Rows.Count
Dim L as long
Dim Lo As Long
L = 12
Lo = 16
For L = L To lngTotalRows
If Cells(L, 1).Text < "" Then
For Lo = Lo To lngTotalRows
If Cells(Lo, 1).Text < "" Then
Cells((Lo - 1), 8) =
WorksheetFunction.Sum(Range(Cells(L, 8), Cells(Lo, 8)))
End If
Next Lo
End If
Next L

the idea for this loop is to give me the total for each title, the
problem with this code is that the range is not being updated
correctly, the first position for the range always stays on the same
place, also because on the way that the loop works, i'm not getting a
total for the last title, how can i overcome this problem?, or is
there an easier way to do this? what i'm missing? help!!, if anyone
needs more information please let me know, thanks in advance


 
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
Nested If Loop Limitation for Excel 2003 raj74 Excel Discussion (Misc queries) 9 March 1st 09 06:14 PM
Nested loop [email protected] Excel Worksheet Functions 1 April 5th 07 12:50 AM
Nested Loop Link ashcrusher Excel Worksheet Functions 0 January 13th 06 03:46 AM
HELP!!!! Can't stop a loop (NOT an infinite loop) TBA[_2_] Excel Programming 3 December 14th 03 03:33 PM
Nested loop with ranking jp Excel Programming 2 October 2nd 03 03:28 PM


All times are GMT +1. The time now is 02:55 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"