beartooth91
Board Regular
- Joined
- Dec 15, 2024
- Messages
- 80
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
I've built vba to sort ascending many times with no problems. This time, I'm trying to sort by colors and am getting the "Unable to get the Sort property of the Range class", in this section of code:
I've tried a few variations with no success. I have no idea what the problem is......
VBA Code:
' Sort duplicates by color, putting them at the top of the sheet
.Range("B11:BP" & lastRow).Sort.Add(Key1:=.Range("B11"), _
SortOn:=xlSortOnCellColor, _
Order1:=xlAscending).SortOnValue.Color = RGB(0, 204, 255)
.Range("B11:BP" & lastRow).Sort.Add(Key2:=.Range("B11"), _
SortOn:=xlSortOnCellColor, _
Order2:=xlAscending).SortOnValue.Color = RGB(204, 255, 255)
I've tried a few variations with no success. I have no idea what the problem is......