J
JCO
I have a sort routine shown below: However, I need H62, F62, B62 & I62 to
not be fixed. How can I determine this number which can be 3000 lines of
data. How do I enter this in the code.
Thanks
Private Sub SortCategoryAssistanceWithHeaders()
'///////////////////////////////////////////////////
'
' SortCategoryAssistanceWithHeaders Macro
' jco - This routine will do a triple level sort
' on 3-columns, omitting the Header
'
'///////////////////////////////////////////////////
'
Cells.Select
ActiveWorkbook.ActiveSheet.Sort.SortFields.Clear
ActiveWorkbook.ActiveSheet.Sort.SortFields.Add Key _
:=Range("H2:H62"), SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption _
:=xlSortNormal
ActiveWorkbook.ActiveSheet.Sort.SortFields.Add Key _
:=Range("F2:F62"), SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption _
:=xlSortNormal
ActiveWorkbook.ActiveSheet.Sort.SortFields.Add Key _
:=Range("B2:B62"), SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption _
:=xlSortNormal
With ActiveWorkbook.ActiveSheet.Sort
.SetRange Range("A1:I62")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
not be fixed. How can I determine this number which can be 3000 lines of
data. How do I enter this in the code.
Thanks
Private Sub SortCategoryAssistanceWithHeaders()
'///////////////////////////////////////////////////
'
' SortCategoryAssistanceWithHeaders Macro
' jco - This routine will do a triple level sort
' on 3-columns, omitting the Header
'
'///////////////////////////////////////////////////
'
Cells.Select
ActiveWorkbook.ActiveSheet.Sort.SortFields.Clear
ActiveWorkbook.ActiveSheet.Sort.SortFields.Add Key _
:=Range("H2:H62"), SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption _
:=xlSortNormal
ActiveWorkbook.ActiveSheet.Sort.SortFields.Add Key _
:=Range("F2:F62"), SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption _
:=xlSortNormal
ActiveWorkbook.ActiveSheet.Sort.SortFields.Add Key _
:=Range("B2:B62"), SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption _
:=xlSortNormal
With ActiveWorkbook.ActiveSheet.Sort
.SetRange Range("A1:I62")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub