S
shafer2717
I have a workbook with 2 worksheets in it. One labeled "2007" the
other "2007 Invoices". In the "2007" worksheet, there are three
columns, "Date", "Last Name,First Name", and "Description". They are
Column A, B, and C respectively. In the "2007 Invoices" worksheet
there is basically an identical set up in terms of column headers
(theres some extra columns, but they have no impact on the situation).
In "2007 Invoices" cells, I have formulas so that as data is added to
"2007", it shows up in "2007 Invoices" as well. The formula I have
carried out over 1100 rows so that I can be sure all entries will
carry over from "2007". The part I'm getting caught up on is creating
an automatic sorting macro for "2007 Invoices". So far I have:
Private Sub Worksheet_Activate()
Dim LRow As Long '-- SORT on Col A then B
'Find row before last row in Column B with content
LRow = Cells(Rows.Count, 1).End(xlDown).Offset(-1, 0).Row
Rows("5:" & LRow).Sort Key1:=Range("B5"), _
Order1:=xlAscending, Key2:=Range("A5"), _
Order2:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End Sub
I want it sorted alphabetically, then chronologically within each name
listed. When I run the macro, the names entered are sorted properly,
but they show up at the bottom of my list. So if I have 5 entries,
they show up in cells 1096-1100. I'm not sure how to move the entries
to the top of my list (entries start in row 5 because I have heading
information in Rows 1-4). Any input would be appreciated. Thanks.
other "2007 Invoices". In the "2007" worksheet, there are three
columns, "Date", "Last Name,First Name", and "Description". They are
Column A, B, and C respectively. In the "2007 Invoices" worksheet
there is basically an identical set up in terms of column headers
(theres some extra columns, but they have no impact on the situation).
In "2007 Invoices" cells, I have formulas so that as data is added to
"2007", it shows up in "2007 Invoices" as well. The formula I have
carried out over 1100 rows so that I can be sure all entries will
carry over from "2007". The part I'm getting caught up on is creating
an automatic sorting macro for "2007 Invoices". So far I have:
Private Sub Worksheet_Activate()
Dim LRow As Long '-- SORT on Col A then B
'Find row before last row in Column B with content
LRow = Cells(Rows.Count, 1).End(xlDown).Offset(-1, 0).Row
Rows("5:" & LRow).Sort Key1:=Range("B5"), _
Order1:=xlAscending, Key2:=Range("A5"), _
Order2:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End Sub
I want it sorted alphabetically, then chronologically within each name
listed. When I run the macro, the names entered are sorted properly,
but they show up at the bottom of my list. So if I have 5 entries,
they show up in cells 1096-1100. I'm not sure how to move the entries
to the top of my list (entries start in row 5 because I have heading
information in Rows 1-4). Any input would be appreciated. Thanks.