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: 112
Default Total a Variable Based on Another Variable Please

Hi,

The Snippet of Code Below Works Great.
i is a Loop Counter that Produces the Numbers from 23 to 324 in a Column
"C".
The nType(i) Produces the Results Associated with the i Values in Column
"D".
Then at the Bottom the nTypeTotal Produces the Total Sum for the nType
Values.

nTypeTotal = ActiveCell.Row

For i = 23 To 324
ActiveCell.Offset(1, 0).Value = "Count for"
ActiveCell.Offset(1, 1).Value = i
ActiveCell.Offset(1, 2).Value = nType(i)
ActiveCell.Offset(1, 0).Select
Next i

Set rng = ActiveCell.Offset(1, 2)
rng.FormulaR1C1 = "=Sum(R" & nTypeTotal & "C:R[-1]C)"
rng.Formula = rng.Value

What I would like, is After the nTypeTotal ( Starting 2 Rows Down and
Continuing Down ), the Sum Total of the Following Please :-

If i = 23 And If i <= 50 Then the nType Total Associated with i = 23
And i <= 50.
If i = 51 And If i <= 100 Then the nType Total Associated with i = 51
And i <= 100.
If i = 101 And If i <= 150 Then the nType Total Associated with i =
101 And i <= 150.
If i = 151 And If i <= 200 Then the nType Total Associated with i =
151 And i <= 200.
If i = 201 And If i <= 250 Then the nType Total Associated with i =
201 And i <= 250.
If i = 251 And If i <= 300 Then the nType Total Associated with i =
251 And i <= 300.
If i = 301 And If i <= 324 Then the nType Total Associated with i =
301 And i <= 324.

Is this Possible Using Code like the nTypeTotal to Output the Values
Only, Instead of the Code Entering Formulas into the Worksheet Please.

Thanks in Advance.
All the Best.
Paul




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
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
Sum cells based on a row variable and seperate column variable CheeseHeadTransplant Excel Worksheet Functions 10 September 23rd 05 06:59 PM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM
Total a Variable Paul Black[_2_] Excel Programming 21 March 19th 05 10:14 AM
Run-time error '91': "Object variable or With block variable not set Mike[_92_] Excel Programming 2 December 30th 04 10:59 AM
variable counter/total Carole Excel Programming 1 October 20th 03 07:23 AM


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