UnsolvedCoding
Technical User
I am trying to get the following code to sort the indicated cells but when it hits .Apply I get an error message.
Some of the cells in a row are blank because as people are added to the list they don't have information, and some of the cells in a column are blank because it expandes each week to fit one column for each week of the year plus the two fixed columns of A and B.
I have tried using integers, various Chr(65) forms etc and ntohing seems to work, it always get stuck on .Apply
Private Sub Sort_Summary()
ActiveWorkbook.Worksheets("Summary").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Summary").Sort.SortFields.Add Key:=Range("A5:BB99") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Summary").Sort
.SetRange Range("A4:BB99")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Any ideas?
Some of the cells in a row are blank because as people are added to the list they don't have information, and some of the cells in a column are blank because it expandes each week to fit one column for each week of the year plus the two fixed columns of A and B.
I have tried using integers, various Chr(65) forms etc and ntohing seems to work, it always get stuck on .Apply
Private Sub Sort_Summary()
ActiveWorkbook.Worksheets("Summary").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Summary").Sort.SortFields.Add Key:=Range("A5:BB99") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Summary").Sort
.SetRange Range("A4:BB99")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Any ideas?