LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default MACRO HELP WITH SUBTOTAL AND RANGES

I am new to using macros and need some help! Here is the problem with some
backround:
I run a report each week where I need to filter and delete unecessary
information and then sort and subtotal the remainder. I sort by agent name
(column A) and then by agent activity (column D) I then subtotal at each
change in Agent Name use function count add subtotal to Column B. I then
subtotal again for each change in Agent Activity (column D) use function
count and add subtotal to Column E. I created the macro by using record
macro and it works when I test it on the data that I created it on. However,
if I try it on a smaller or larger amount of data the subtotal for agent
activity does not work correctly it does not combine the activity for each
agent but subtotals every couple of rows. (this will change each week, the
columns will remain the same but the rows may be more or less) I believe the
problems lies within the subtotals I have set up. Thank you in advance for
any hep and advice!

Lee



Here is the macro:

Sub BCMreport()
'
' BCMreport Macro
' Used for weekly Customer Service report
'

'
Selection.AutoFilter
ActiveSheet.Range("$A$1:$E$3200").AutoFilter Field:=4, Criteria1:=Array( _
"Available Time", "Break Time", "Internal call", "Login Time",
"Logout", "Not Ready" _
), Operator:=xlFilterValues
Rows("2:3201").Select
Selection.Delete Shift:=xlUp
ActiveSheet.Range("$A$1:$E$1176").AutoFilter Field:=4
Columns("A:E").Select
Selection.AutoFilter
ActiveWorkbook.Worksheets("Sheet1").Sort.SortField s.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortField s.Add
Key:=Range("A2:A3200" _
), SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Sheet1").Sort.SortField s.Add
Key:=Range("D2:D3200" _
), SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A1:E3200")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Selection.Subtotal GroupBy:=1, Function:=xlCount, TotalList:=Array(2), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
Selection.Subtotal GroupBy:=4, Function:=xlCount, TotalList:=Array(5), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
ActiveSheet.Outline.ShowLevels RowLevels:=2
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
Macro to AddRow and Subtotal simplymidori[_2_] Excel Discussion (Misc queries) 0 April 30th 08 03:50 PM
Macro add row and subtotal simplymidori[_2_] Excel Discussion (Misc queries) 0 April 30th 08 12:34 AM
macro excel subtotal in subtotal GBO Excel Discussion (Misc queries) 2 November 29th 07 02:15 PM
Remove Subtotal In Macro Not Working Jerry Cropanese New Users to Excel 0 June 27th 05 05:13 AM
Subtotal Macro [email protected] Excel Worksheet Functions 1 January 26th 05 11:13 AM


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