View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
childofthe1980s childofthe1980s is offline
external usenet poster
 
Posts: 122
Default why does Average only on certain cells?

Hello:

I created a macro that performs, among other things, the Average function in
a spreadsheet. Below is an excerpt from it.

I am perplexed as to why the "Range" value is a limited number of cells. I
did not mean for it to be that way. I highlighted the entire spreadsheet
when I recorded the macro and before I selected to Average. I don't
understand why it did not capture all of the cells.

As you notice, the range is only A1:E1688. I did not mean for that to
happen. How do I modify this so that it encompasses all data in the
spreadsheet (and--by the way--not all of the potentially thousands of blank
rows beneath the data)?

childofthe1980s

Selection.Subtotal GroupBy:=1, Function:=xlAverage, TotalList:=Array(3,
5) _
, Replace:=True, PageBreaks:=False, SummaryBelowData:=True
ActiveSheet.Outline.ShowLevels RowLevels:=2
Range("A1:E1688").Sort Key1:=Range("E2"), Order1:=xlDescending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal