Hi,
I'm trying to sort a spreadsheet based on cell color in a specific column using the code below, but I get a message "Method 'Range' of object'_Global' failed". What am I doing wrong? Rows 1 through 4 are not to be included in the sort, that's why I'm setting the range starting in "D5". Hope someone can help me with this.
ActiveSheet.SORT.SortFields.Clear
ActiveSheet.SORT.SortFields.Add(Range("D5:D"), _
xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(141, 180, 226)
With ActiveSheet.SORT
.SetRange Range("D5:D")
.Header = True
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Thanks!
Bookmarks