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: 12
Default Subroutine Summing and Outlining

Hi,

I want to create a subroutine that will accomplish four things:

1) insert rows above a range;

2) populate those rows;

3) sum the total of the inserted rows on to the named range; and

4) create an outline of the added rows.


I will pass this subrountine an array called arArray(). It will contain a
set of numbers which then determine the number of rows to inserts. Array
could contain over 100 numbers.

It is easier to explain what I need to do by way of example.

Let's assume arArray contains (2,6,8,12)

1) Then I need to insert four rows on a summary sheet range called
rnSummaryData.

2) I need to populate the four rows from sheets P2, P6, P8, and 12, all
having a local range name "rnData". "P" represents project. I want to
populate the four rows using links.

3) I need to create a sum total of the four to rnSummaryData.

4) I need to create an outline.


Here's what I have done so far. Please feel free to modify code to make it
better, more streamlined.

Sub GetSummary()
Dim arArray(1 To 4) As Integer

'\ 4 for this example...in my code it will be variable

Dim iNoArrayElements As Integer
Dim iCounter1 As Integer
Dim iCounter2 As Integer

arArray(1) = 2
arArray(2) = 6
arArray(3) = 8
arArray(4) = 12

iNoArrayElements = UBound(arArray) - LBound(arArray) + 1

For iCounter1 = 1 To iNoArrayElements
'\ is there a way to do this in one step rather than looping?
Worksheets("Summary").Range("rnSummaryData").Inser t Shift:=xlDown
Next iCounter1

iCounter2 = 0

For iCounter1 = iNoArrayElements To 1 Step -1
iCounter2 = iCounter2 + 1
Worksheets("Summary").Range("rnSummaryData").Offse t(-iCounter1,
0).Formula = _
"='P" & arArray(iCounter1) & "'!" & "RnData"
Next iCounter1

'\ Next How do I sum and outline of the added rows? Again, it's important
to
'\ know that the array arArray size will change.

End Sub


 
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
Call a subroutine using variable subroutine name dhstein Excel Discussion (Misc queries) 3 July 26th 09 08:28 PM
Hierarchical outlining Michael.Tarnowski Excel Worksheet Functions 4 April 8th 09 10:59 AM
Hierarchical outlining Michael.Tarnowski Excel Worksheet Functions 2 April 1st 09 10:27 AM
How To Quit Subroutine from a called subroutine Rich J[_2_] Excel Programming 5 February 20th 07 06:48 PM
outlining / Grouping AFREP Excel Discussion (Misc queries) 1 August 17th 06 11:10 PM


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