[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

Help with using arrays or just help in general!!!!

bpotter

12/14/2006 5:25:00 PM

I am trying to write a macro that filter about 5000 rows into the
different dates. After filtering the dates from Jan04 to Dec08 it then
copies the rows to a different sheet. After each date range is filtered
it then adds a row to add all costs together. I can do the filtering
part of it. but each time I do it gives me an error telling me that my
macro is too large. That is why I think I need an array. Or actually
anything.
Feel free to tell me if I am an idiot. I want to keep the added rows in
some kind of variable reference because I want to use them in other
macros in the workbook to create graphs and cost analysis. If someone
could help me get started it would be great. I have been working on
this for several days now.

3 Answers

bpotter

12/14/2006 7:21:00 PM

0

Sub sort_WC()
Dim wscost As Worksheet
Dim wscostsort As Worksheet

Dim x As Long
Dim lrow1 As Long
Dim cnt As Long
Dim xjan04 As Long
Dim xfeb04 As Long
Dim xmar04 As Long
Dim xapr04 As Long
Dim xmay04 As Long
Dim xjun04 As Long
Dim xjul04 As Long
Dim xaug04 As Long
Dim xsep04 As Long
Dim xoct04 As Long
Dim xnov04 As Long
Dim xdec04 As Long
Dim xjan05 As Long
Dim xfeb05 As Long
Dim xmar05 As Long
Dim xapr05 As Long
Dim xmay05 As Long
Dim xjun05 As Long
Dim xjul05 As Long
Dim xaug05 As Long
Dim xsep05 As Long
Dim xoct05 As Long
Dim xnov05 As Long
Dim xdec05 As Long
Dim xjan06 As Long
Dim xfeb06 As Long
Dim xmar06 As Long
Dim xapr06 As Long
Dim xmay06 As Long
Dim xjun06 As Long
Dim xjul06 As Long
Dim xaug06 As Long
Dim xsep06 As Long
Dim xoct06 As Long
Dim xnov06 As Long
Dim xdec06 As Long
Dim xjan07 As Long
Dim xfeb07 As Long
Dim xmar07 As Long
Dim xapr07 As Long
Dim xmay07 As Long
Dim xjun07 As Long
Dim xjul07 As Long
Dim xaug07 As Long
Dim xsep07 As Long
Dim xoct07 As Long
Dim xnov07 As Long
Dim xdec07 As Long
Dim xjan08 As Long
Dim xfeb08 As Long
Dim xmar08 As Long
Dim xapr08 As Long
Dim xmay08 As Long
Dim xjun08 As Long
Dim xjul08 As Long
Dim xaug08 As Long
Dim xsep08 As Long
Dim xoct08 As Long
Dim xnov08 As Long
Dim xdec08 As Long


Set wscost = ThisWorkbook.Sheets("Cost Categories")
Set wscostsort = ThisWorkbook.Sheets("Cost Sort")

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Jan-04"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
wscostsort.Range("a4").PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xjan04 = lrow + 1
wscostsort.Range("h" & xjan04).Formula = "=sum(h4:h" & lrow & ")"
wscostsort.Range("h" & xjan04, "ah" & xjan04).FillRight
wscostsort.Range("ai" & xjan04).Formula = "=SUM(AF" & xjan04 & "/((AH"
& xjan04 & "*6)+AG" & xjan04 & "))"
End If



Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Feb-04"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xjan04 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xfeb04 = lrow + 1
wscostsort.Range("h" & xfeb04).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xfeb04, "ah" & xfeb04).FillRight
wscostsort.Range("ai" & xfeb04).Formula = "=SUM(AF" & xfeb04 & "/((AH"
& xfeb04 & "*6)+AG" & xfeb04 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Mar-04"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xfeb04 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xmar04 = lrow + 1
wscostsort.Range("h" & xmar04).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xmar04, "ah" & xmar04).FillRight
wscostsort.Range("ai" & xmar04).Formula = "=SUM(AF" & xmar04 & "/((AH"
& xmar04 & "*6)+AG" & xmar04 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Apr-04"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xmar04 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xapr04 = lrow + 1
wscostsort.Range("h" & xapr04).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xapr04, "ah" & xapr04).FillRight
wscostsort.Range("ai" & xapr04).Formula = "=SUM(AF" & xapr04 & "/((AH"
& xapr04 & "*6)+AG" & xapr04 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="May-04"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xapr04 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xmay04 = lrow + 1
wscostsort.Range("h" & xmay04).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xmay04, "ah" & xmay04).FillRight
wscostsort.Range("ai" & xmay04).Formula = "=SUM(AF" & xmay04 & "/((AH"
& xmay04 & "*6)+AG" & xmay04 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Jun-04"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xmay04 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xjun04 = lrow + 1
wscostsort.Range("h" & xjun04).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xjun04, "ah" & xjun04).FillRight
wscostsort.Range("ai" & xjun04).Formula = "=SUM(AF" & xjun04 & "/((AH"
& xjun04 & "*6)+AG" & xjun04 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Jul-04"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xjun04 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xjul04 = lrow + 1
wscostsort.Range("h" & xjul04).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xjul04, "ah" & xjul04).FillRight
wscostsort.Range("ai" & xjul04).Formula = "=SUM(AF" & xjul04 & "/((AH"
& xjul04 & "*6)+AG" & xjul04 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Aug-04"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xjul04 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xaug04 = lrow + 1
wscostsort.Range("h" & xaug04).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xaug04, "ah" & xaug04).FillRight
wscostsort.Range("ai" & xaug04).Formula = "=SUM(AF" & xaug04 & "/((AH"
& xaug04 & "*6)+AG" & xaug04 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Sep-04"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xaug04 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xsep04 = lrow + 1
wscostsort.Range("h" & xsep04).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xsep04, "ah" & xsep04).FillRight
wscostsort.Range("ai" & xsep04).Formula = "=SUM(AF" & xsep04 & "/((AH"
& xsep04 & "*6)+AG" & xsep04 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Oct-04"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xsep04 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xoct04 = lrow + 1
wscostsort.Range("h" & xoct04).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xoct04, "ah" & xoct04).FillRight
wscostsort.Range("ai" & xoct04).Formula = "=SUM(AF" & xoct04 & "/((AH"
& xoct04 & "*6)+AG" & xoct04 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Nov-04"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xoct04 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xnov04 = lrow + 1
wscostsort.Range("h" & xnov04).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xnov04, "ah" & xnov04).FillRight
wscostsort.Range("ai" & xnov04).Formula = "=SUM(AF" & xnov04 & "/((AH"
& xnov04 & "*6)+AG" & xnov04 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Dec-04"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xnov04 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xdec04 = lrow + 1
wscostsort.Range("h" & xdec04).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xdec04, "ah" & xdec04).FillRight
wscostsort.Range("ai" & xdec04).Formula = "=SUM(AF" & xdec04 & "/((AH"
& xdec04 & "*6)+AG" & xdec04 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Jan-05"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xdec04 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xjan05 = lrow + 1
wscostsort.Range("h" & xjan05).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xjan05, "ah" & xjan05).FillRight
wscostsort.Range("ai" & xjan05).Formula = "=SUM(AF" & xjan05 & "/((AH"
& xjan05 & "*6)+AG" & xjan05 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Feb-05"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xjan05 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xfeb05 = lrow + 1
wscostsort.Range("h" & xfeb05).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xfeb05, "ah" & xfeb05).FillRight
wscostsort.Range("ai" & xfeb05).Formula = "=SUM(AF" & xfeb05 & "/((AH"
& xfeb05 & "*6)+AG" & xfeb05 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Mar-05"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xfeb05 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xmar05 = lrow + 1
wscostsort.Range("h" & xmar05).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xmar05, "ah" & xmar05).FillRight
wscostsort.Range("ai" & xmar05).Formula = "=SUM(AF" & xmar05 & "/((AH"
& xmar05 & "*6)+AG" & xmar05 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Apr-05"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xmar05 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xapr05 = lrow + 1
wscostsort.Range("h" & xapr05).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xapr05, "ah" & xapr05).FillRight
wscostsort.Range("ai" & xapr05).Formula = "=SUM(AF" & xapr05 & "/((AH"
& xapr05 & "*6)+AG" & xapr05 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="May-05"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xapr05 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xmay05 = lrow + 1
wscostsort.Range("h" & xmay05).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xmay05, "ah" & xmay05).FillRight
wscostsort.Range("ai" & xmay05).Formula = "=SUM(AF" & xmay05 & "/((AH"
& xmay05 & "*6)+AG" & xmay05 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Jun-05"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xmay05 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xjun05 = lrow + 1
wscostsort.Range("h" & xjun05).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xjun05, "ah" & xjun05).FillRight
wscostsort.Range("ai" & xjun05).Formula = "=SUM(AF" & xjun05 & "/((AH"
& xjun05 & "*6)+AG" & xjun05 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Jul-05"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xjun05 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xjul05 = lrow + 1
wscostsort.Range("h" & xjul05).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xjul05, "ah" & xjul05).FillRight
wscostsort.Range("ai" & xjul05).Formula = "=SUM(AF" & xjul05 & "/((AH"
& xjul05 & "*6)+AG" & xjul05 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Aug-05"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xjul05 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xaug05 = lrow + 1
wscostsort.Range("h" & xaug05).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xaug05, "ah" & xaug05).FillRight
wscostsort.Range("ai" & xaug05).Formula = "=SUM(AF" & xaug05 & "/((AH"
& xaug05 & "*6)+AG" & xaug05 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Sep-05"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xaug05 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xsep05 = lrow + 1
wscostsort.Range("h" & xsep05).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xsep05, "ah" & xsep05).FillRight
wscostsort.Range("ai" & xsep05).Formula = "=SUM(AF" & xsep05 & "/((AH"
& xsep05 & "*6)+AG" & xsep05 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Oct-05"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xsep05 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xoct05 = lrow + 1
wscostsort.Range("h" & xoct05).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xoct05, "ah" & xoct05).FillRight
wscostsort.Range("ai" & xoct05).Formula = "=SUM(AF" & xoct05 & "/((AH"
& xoct05 & "*6)+AG" & xoct05 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Nov-05"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xoct05 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xnov05 = lrow + 1
wscostsort.Range("h" & xnov05).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xnov05, "ah" & xnov05).FillRight
wscostsort.Range("ai" & xnov05).Formula = "=SUM(AF" & xnov05 & "/((AH"
& xnov05 & "*6)+AG" & xnov05 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Dec-05"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xnov05 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xdec05 = lrow + 1
wscostsort.Range("h" & xdec05).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xdec05, "ah" & xdec05).FillRight
wscostsort.Range("ai" & xdec05).Formula = "=SUM(AF" & xdec05 & "/((AH"
& xdec05 & "*6)+AG" & xdec05 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Jan-06"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xdec05 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xjan06 = lrow + 1
wscostsort.Range("h" & xjan06).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xjan06, "ah" & xjan06).FillRight
wscostsort.Range("ai" & xjan06).Formula = "=SUM(AF" & xjan06 & "/((AH"
& xjan06 & "*6)+AG" & xjan06 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Feb-06"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xjan06 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xfeb06 = lrow + 1
wscostsort.Range("h" & xfeb06).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xfeb06, "ah" & xfeb06).FillRight
wscostsort.Range("ai" & xfeb06).Formula = "=SUM(AF" & xfeb06 & "/((AH"
& xfeb06 & "*6)+AG" & xfeb06 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Mar-06"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xfeb06 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xmar06 = lrow + 1
wscostsort.Range("h" & xmar06).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xmar06, "ah" & xmar06).FillRight
wscostsort.Range("ai" & xmar06).Formula = "=SUM(AF" & xmar06 & "/((AH"
& xmar06 & "*6)+AG" & xmar06 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Apr-06"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xmar06 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xapr06 = lrow + 1
wscostsort.Range("h" & xapr06).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xapr06, "ah" & xapr06).FillRight
wscostsort.Range("ai" & xapr06).Formula = "=SUM(AF" & xapr06 & "/((AH"
& xapr06 & "*6)+AG" & xapr06 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="May-06"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xapr06 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xmay06 = lrow + 1
wscostsort.Range("h" & xmay06).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xmay06, "ah" & xmay06).FillRight
wscostsort.Range("ai" & xmay06).Formula = "=SUM(AF" & xmay06 & "/((AH"
& xmay06 & "*6)+AG" & xmay06 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Jun-06"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xmay06 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xjun06 = lrow + 1
wscostsort.Range("h" & xjun06).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xjun06, "ah" & xjun06).FillRight
wscostsort.Range("ai" & xjun06).Formula = "=SUM(AF" & xjun06 & "/((AH"
& xjun06 & "*6)+AG" & xjun06 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Jul-06"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xjun06 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xjul06 = lrow + 1
wscostsort.Range("h" & xjul06).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xjul06, "ah" & xjul06).FillRight
wscostsort.Range("ai" & xjul06).Formula = "=SUM(AF" & xjul06 & "/((AH"
& xjul06 & "*6)+AG" & xjul06 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Aug-06"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xjul06 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xaug06 = lrow + 1
wscostsort.Range("h" & xaug06).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xaug06, "ah" & xaug06).FillRight
wscostsort.Range("ai" & xaug06).Formula = "=SUM(AF" & xaug06 & "/((AH"
& xaug06 & "*6)+AG" & xaug06 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Sep-06"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xaug06 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xsep06 = lrow + 1
wscostsort.Range("h" & xsep06).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xsep06, "ah" & xsep06).FillRight
wscostsort.Range("ai" & xsep06).Formula = "=SUM(AF" & xsep06 & "/((AH"
& xsep06 & "*6)+AG" & xsep06 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Oct-06"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xsep06 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xoct06 = lrow + 1
wscostsort.Range("h" & xoct06).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xoct06, "ah" & xoct06).FillRight
wscostsort.Range("ai" & xoct06).Formula = "=SUM(AF" & xoct06 & "/((AH"
& xoct06 & "*6)+AG" & xoct06 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Nov-06"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xoct06 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xnov06 = lrow + 1
wscostsort.Range("h" & xnov06).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xnov06, "ah" & xnov06).FillRight
wscostsort.Range("ai" & xnov06).Formula = "=SUM(AF" & xnov06 & "/((AH"
& xnov06 & "*6)+AG" & xnov06 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Dec-06"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xnov06 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xdec06 = lrow + 1
wscostsort.Range("h" & xdec06).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xdec06, "ah" & xdec06).FillRight
wscostsort.Range("ai" & xdec06).Formula = "=SUM(AF" & xdec06 & "/((AH"
& xdec06 & "*6)+AG" & xdec06 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Jan-07"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xdec06 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xjan07 = lrow + 1
wscostsort.Range("h" & xjan07).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xjan07, "ah" & xjan07).FillRight
wscostsort.Range("ai" & xjan07).Formula = "=SUM(AF" & xjan07 & "/((AH"
& xjan07 & "*6)+AG" & xjan07 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Feb-07"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xjan07 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xfeb07 = lrow + 1
wscostsort.Range("h" & xfeb07).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xfeb07, "ah" & xfeb07).FillRight
wscostsort.Range("ai" & xfeb07).Formula = "=SUM(AF" & xfeb07 & "/((AH"
& xfeb07 & "*6)+AG" & xfeb07 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Mar-07"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xfeb07 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xmar07 = lrow + 1
wscostsort.Range("h" & xmar07).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xmar07, "ah" & xmar07).FillRight
wscostsort.Range("ai" & xmar07).Formula = "=SUM(AF" & xmar07 & "/((AH"
& xmar07 & "*6)+AG" & xmar07 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Apr-07"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xmar07 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xapr07 = lrow + 1
wscostsort.Range("h" & xapr07).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xapr07, "ah" & xapr07).FillRight
wscostsort.Range("ai" & xapr07).Formula = "=SUM(AF" & xapr07 & "/((AH"
& xapr07 & "*6)+AG" & xapr07 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="May-07"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xapr07 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xmay07 = lrow + 1
wscostsort.Range("h" & xmay07).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xmay07, "ah" & xmay07).FillRight
wscostsort.Range("ai" & xmay07).Formula = "=SUM(AF" & xmay07 & "/((AH"
& xmay07 & "*6)+AG" & xmay07 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Jun-07"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xmay07 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xjun07 = lrow + 1
wscostsort.Range("h" & xjun07).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xjun07, "ah" & xjun07).FillRight
wscostsort.Range("ai" & xjun07).Formula = "=SUM(AF" & xjun07 & "/((AH"
& xjun07 & "*6)+AG" & xjun07 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Jul-07"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xjun07 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xjul07 = lrow + 1
wscostsort.Range("h" & xjul07).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xjul07, "ah" & xjul07).FillRight
wscostsort.Range("ai" & xjul07).Formula = "=SUM(AF" & xjul07 & "/((AH"
& xjul07 & "*6)+AG" & xjul07 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Aug-07"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xjul07 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xaug07 = lrow + 1
wscostsort.Range("h" & xaug07).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xaug07, "ah" & xaug07).FillRight
wscostsort.Range("ai" & xaug07).Formula = "=SUM(AF" & xaug07 & "/((AH"
& xaug07 & "*6)+AG" & xaug07 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Sep-07"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xaug07 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xsep07 = lrow + 1
wscostsort.Range("h" & xsep07).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xsep07, "ah" & xsep07).FillRight
wscostsort.Range("ai" & xsep07).Formula = "=SUM(AF" & xsep07 & "/((AH"
& xsep07 & "*6)+AG" & xsep07 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Oct-07"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xsep07 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xoct07 = lrow + 1
wscostsort.Range("h" & xoct07).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xoct07, "ah" & xoct07).FillRight
wscostsort.Range("ai" & xoct07).Formula = "=SUM(AF" & xoct07 & "/((AH"
& xoct07 & "*6)+AG" & xoct07 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Nov-07"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xoct07 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xnov07 = lrow + 1
wscostsort.Range("h" & xnov07).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xnov07, "ah" & xnov07).FillRight
wscostsort.Range("ai" & xnov07).Formula = "=SUM(AF" & xnov07 & "/((AH"
& xnov07 & "*6)+AG" & xnov07 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Dec-07"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xnov07 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xdec07 = lrow + 1
wscostsort.Range("h" & xdec07).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xdec07, "ah" & xdec07).FillRight
wscostsort.Range("ai" & xdec07).Formula = "=SUM(AF" & xdec07 & "/((AH"
& xdec07 & "*6)+AG" & xdec07 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Jan-08"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xdec07 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xjan08 = lrow + 1
wscostsort.Range("h" & xjan08).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xjan08, "ah" & xjan08).FillRight
wscostsort.Range("ai" & xjan08).Formula = "=SUM(AF" & xjan08 & "/((AH"
& xjan08 & "*6)+AG" & xjan08 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Feb-08"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xjan08 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xfeb08 = lrow + 1
wscostsort.Range("h" & xfeb08).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xfeb08, "ah" & xfeb08).FillRight
wscostsort.Range("ai" & xfeb08).Formula = "=SUM(AF" & xfeb08 & "/((AH"
& xfeb08 & "*6)+AG" & xfeb08 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Mar-08"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xfeb08 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xmar08 = lrow + 1
wscostsort.Range("h" & xmar08).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xmar08, "ah" & xmar08).FillRight
wscostsort.Range("ai" & xmar08).Formula = "=SUM(AF" & xmar08 & "/((AH"
& xmar08 & "*6)+AG" & xmar08 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Apr-08"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xmar08 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xapr08 = lrow + 1
wscostsort.Range("h" & xapr08).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xapr08, "ah" & xapr08).FillRight
wscostsort.Range("ai" & xapr08).Formula = "=SUM(AF" & xapr08 & "/((AH"
& xapr08 & "*6)+AG" & xapr08 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="May-08"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xapr08 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xmay08 = lrow + 1
wscostsort.Range("h" & xmay08).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xmay08, "ah" & xmay08).FillRight
wscostsort.Range("ai" & xmay08).Formula = "=SUM(AF" & xmay08 & "/((AH"
& xmay08 & "*6)+AG" & xmay08 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Jun-08"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xmay08 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xjun08 = lrow + 1
wscostsort.Range("h" & xjun08).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xjun08, "ah" & xjun08).FillRight
wscostsort.Range("ai" & xjun08).Formula = "=SUM(AF" & xjun08 & "/((AH"
& xjun08 & "*6)+AG" & xjun08 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Jul-08"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xjun08 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xjul08 = lrow + 1
wscostsort.Range("h" & xjul08).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xjul08, "ah" & xjul08).FillRight
wscostsort.Range("ai" & xjul08).Formula = "=SUM(AF" & xjul08 & "/((AH"
& xjul08 & "*6)+AG" & xjul08 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Aug-08"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xjul08 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xaug08 = lrow + 1
wscostsort.Range("h" & xaug08).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xaug08, "ah" & xaug08).FillRight
wscostsort.Range("ai" & xaug08).Formula = "=SUM(AF" & xaug08 & "/((AH"
& xaug08 & "*6)+AG" & xaug08 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Sep-08"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xaug08 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xsep08 = lrow + 1
wscostsort.Range("h" & xsep08).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xsep08, "ah" & xsep08).FillRight
wscostsort.Range("ai" & xsep08).Formula = "=SUM(AF" & xsep08 & "/((AH"
& xsep08 & "*6)+AG" & xsep08 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Oct-08"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xsep08 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xoct08 = lrow + 1
wscostsort.Range("h" & xoct08).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xoct08, "ah" & xoct08).FillRight
wscostsort.Range("ai" & xoct08).Formula = "=SUM(AF" & xoct08 & "/((AH"
& xoct08 & "*6)+AG" & xoct08 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Nov-08"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xoct08 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xnov08 = lrow + 1
wscostsort.Range("h" & xnov08).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xnov08, "ah" & xnov08).FillRight
wscostsort.Range("ai" & xnov08).Formula = "=SUM(AF" & xnov08 & "/((AH"
& xnov08 & "*6)+AG" & xnov08 & "))"
End If

Sheets("Cost Categories").Select
Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="Larry Ross"
Selection.AutoFilter Field:=3, Criteria1:="Dec-08"
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
If wscost.Range("a" & lrow).Value <> "" Then
lrow = wscost.Range("a" & _
wscost.Rows.Count).End(xlUp).Row
wscost.Range("a1:ai" & lrow).Copy
x = xnov08 + 2
wscostsort.Range("a" & x).PasteSpecial
lrow = wscostsort.Range("a" & _
wscostsort.Rows.Count).End(xlUp).Row
xdec08 = lrow + 1
wscostsort.Range("h" & xdec08).Formula = "=sum(h" & x & ":h" & lrow &
")"
wscostsort.Range("h" & xdec08, "ah" & xdec08).FillRight
wscostsort.Range("ai" & xdec08).Formula = "=SUM(AF" & xdec08 & "/((AH"
& xdec08 & "*6)+AG" & xdec08 & "))"
End If

End Sub


error message: Compile Error: Procedure too large

And the thing is this isn't all that I want to do with this macro. So
basically I am screwed or dumb or something to that effect.

Kai Uwe Schmidt

12/14/2006 7:57:00 PM

0

hello there,

I´m not perfectly sure what the result of your filtering is.

Do you create a new workbook/sheet for each date (or a group of dates) or
simply create a filtered result list for further anlysing?

In the second case, there exist several easy ways for your task that are
already available in Excel without VBA.

Besides AdvancedFilter and good old MS Query, I strongly recommend to use a
pivot table with an external reference.
Define the reference range for the table simply by using the columns (e,g,
"$A:$G") so you can refresh it without changing the reference. 5000 Rows do
no harm.

The pivot table gives you all opportunities to filter the data, all kinds of
analysing (much more than simply summing up) and even charts you can filter
intreractively.

Best regards,

Kai Uwe
Cologne, Germany

<bpotter_chk@yahoo.com> schrieb im Newsbeitrag
news:1166117120.742703.27940@16g2000cwy.googlegroups.com...
>I am trying to write a macro that filter about 5000 rows into the
> different dates. After filtering the dates from Jan04 to Dec08 it then
> copies the rows to a different sheet. After each date range is filtered
> it then adds a row to add all costs together. I can do the filtering
> part of it. but each time I do it gives me an error telling me that my
> macro is too large. That is why I think I need an array. Or actually
> anything.
> Feel free to tell me if I am an idiot. I want to keep the added rows in
> some kind of variable reference because I want to use them in other
> macros in the workbook to create graphs and cost analysis. If someone
> could help me get started it would be great. I have been working on
> this for several days now.
>


bpotter

12/14/2006 9:34:00 PM

0

I need something a little more than that though. My excel file is going
to do the following: I have two areas, with 4 foremen, 25 routes, 690
individual wells. Right now I have a jumbled up mess of 5000 lines.
First thing I am doing is filtering the area. I will then filter the
date. I take each group of dates copy and then paste to a new sheet and
add a line that adds the lines from the date ranges. After that I am
going to create a cost analysis sheet with a graph. After I get all
that figured out then I can start working on getting everything sorted
all the way down to each well and doing a cost analysis. I know right
now I can take my big macro and break it down into little macro but I
am hoping that there is an easier way to do all of this. Thanks for all
the help!!!