Hi all,
I have a sheet with information and i use the sort method to display the information i would like to see on top. This works for a few but sometimes displays the sort results in rows 2000 onwards instead of displaying it on top.
Could someone help me see why?
Sub ofinumber()
'
' ofinumber Macro
'
'
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 1
ActiveWindow.SmallScroll Down:=-18
Range("Cf5").Select
Selection.Copy
Range("k1").Select
ActiveSheet.Paste
Range("A3:AP2774").Select
Application.DeleteCustomList ListNum:=11
Application.AddCustomList ListArray:=Array("OFI", ".", "PI", "6S", "HS", "NC", "CC" _
, "SF", "MAINT")
ActiveWorkbook.Worksheets("All OFIs").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("All OFIs").Sort.SortFields.Add Key:=Range( _
"G3:G2774"), SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:= _
"OFI,.,MS,6S,HS,NC,CC,SF,MAINT", DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("All OFIs").Sort.SortFields.Add Key:=Range( _
"a3:a2774"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("All OFIs").Sort.SortFields.Add Key:=Range( _
"E3:E2774"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("All OFIs").Sort
.SetRange Range("A2:AP2774")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWindow.ScrollRow = 3
Rows("3:2774").Select
Rows("3:2774").EntireRow.AutoFit
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
End Sub
I have a sheet with information and i use the sort method to display the information i would like to see on top. This works for a few but sometimes displays the sort results in rows 2000 onwards instead of displaying it on top.
Could someone help me see why?
Sub ofinumber()
'
' ofinumber Macro
'
'
ActiveWindow.ScrollColumn = 13
ActiveWindow.ScrollColumn = 12
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 1
ActiveWindow.SmallScroll Down:=-18
Range("Cf5").Select
Selection.Copy
Range("k1").Select
ActiveSheet.Paste
Range("A3:AP2774").Select
Application.DeleteCustomList ListNum:=11
Application.AddCustomList ListArray:=Array("OFI", ".", "PI", "6S", "HS", "NC", "CC" _
, "SF", "MAINT")
ActiveWorkbook.Worksheets("All OFIs").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("All OFIs").Sort.SortFields.Add Key:=Range( _
"G3:G2774"), SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:= _
"OFI,.,MS,6S,HS,NC,CC,SF,MAINT", DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("All OFIs").Sort.SortFields.Add Key:=Range( _
"a3:a2774"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("All OFIs").Sort.SortFields.Add Key:=Range( _
"E3:E2774"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("All OFIs").Sort
.SetRange Range("A2:AP2774")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWindow.ScrollRow = 3
Rows("3:2774").Select
Rows("3:2774").EntireRow.AutoFit
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
End Sub