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 Help With Total of Values Please

Hi Everybody,

I Have the Following Macro which Produces a List of 7 Totals.
Rather than Using …

ActiveCell.Offset(7, 0).Value = nType(1) + nType(2) + nType(3) +
nType(4) _
+ nType(5) + nType(6) + nType(7)

… to Calculate the Grand Total, is there an Easier VB Solution Rather
than to Use an Excel Formula in the Code Please.

The Macro I am Using is :-

Option Explicit
Option Base 1

Sub Produce_Totals()
Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim D As Integer
Dim E As Integer
Dim F As Integer
Dim I As Integer
Dim nType(7) As Double

Application.ScreenUpdating = False
Sheets("Totals").Select
Range("C4").Select

For I = 1 To 7
nType(I) = 0
Next I

For A = 1 To 25
For B = A + 1 To 26
For C = B + 1 To 27
For D = C + 1 To 28
For E = D + 1 To 29
For F = E + 1 To 30

If F - A = 10 And F - A <= 12 Then nType(1) = nType(1) + 1
If F - A = 13 And F - A <= 16 Then nType(2) = nType(2) + 1
If F - A = 17 And F - A <= 19 Then nType(3) = nType(3) + 1
If F - A = 20 And F - A <= 21 Then nType(4) = nType(4) + 1
If F - A = 22 And F - A <= 24 Then nType(5) = nType(5) + 1
If F - A = 25 And F - A <= 27 Then nType(6) = nType(6) + 1
If F - A = 28 And F - A <= 30 Then nType(7) = nType(7) + 1

Next F
Next E
Next D
Next C
Next B
Next A

For I = 1 To 7
ActiveCell(I, 1).Value = nType(I)
' ActiveCell.Offset(7, 0).Value = nType(1) + nType(2) + nType(3) +
nType(4) _
+ nType(5) + nType(6) + nType(7)
Next I

Application.ScreenUpdating = True
End Sub

I have Tried Including Another Variable to Total them But without ANY
Success. I think I Might have Been Trying to Put it in the Wrong Place
or Something.
Any Help will be Appreciated.

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
I want to key numeric values in one row like a1 and total them in packer7 Excel Worksheet Functions 1 May 23rd 08 03:19 PM
Trying to total the column values in my chart? K8T Charts and Charting in Excel 3 February 11th 08 04:59 PM
Copying Sub-Total Values rajkohli Excel Discussion (Misc queries) 5 May 4th 06 06:40 AM
How do I compare two values to calculate a total? lori_tig Excel Worksheet Functions 3 April 19th 06 12:29 AM
Hiding a total until all values are filled DCZ New Users to Excel 5 March 28th 06 12:15 AM


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