Lindsay0385
New Member
- Joined
- Dec 21, 2016
- Messages
- 30
Hello - I hoping someone can help me with this.
I created a macro using the Macro Recorder to sort a column on my spreadsheet by a custom list.
CUSTOM LIST:
PROJECT CANCELLED
The macro works perfectly on my PC. But when I send the file to my coworker, she gets a "Run-time error '438': Object doesn't support this property or method". On her PC, I tried sorting the column by the custom list manually and I realized that the custom list I made doesn't show up when she opens the workbook.
So I did some googling and added a line to the macro to create the same custom list before my initial code:
I was hoping that would fix it, but she's still getting the run-time error, even though it works perfectly for me. I'm so confused.
Any help anyone can provide would be appreciated.
Thanks!
Lindsay
I created a macro using the Macro Recorder to sort a column on my spreadsheet by a custom list.
CUSTOM LIST:
PROJECT CANCELLED
STAGE 1 - PI
STAGE 2 - RD
STAGE 3 - W
STAGE 4 - LV
STAGE 5 - LD
PROJECT COMPLETE
VBA CODE
STAGE 2 - RD
STAGE 3 - W
STAGE 4 - LV
STAGE 5 - LD
PROJECT COMPLETE
VBA CODE
Code:
ActiveWorkbook.Worksheets("Test").AutoFilter.Sort. _
SortFields.Add2 Key:=Range("B4:B999"), SortOn:=xlSortOnValues, Order:= _
xlAscending, CustomOrder:= _
"PROJECT CANCELLED,STAGE 1 - PI,STAGE 2 - RD,STAGE 3 - W,STAGE 4 - LV,STAGE 5 - LD, PROJECT COMPLETE" _
, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Test").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
The macro works perfectly on my PC. But when I send the file to my coworker, she gets a "Run-time error '438': Object doesn't support this property or method". On her PC, I tried sorting the column by the custom list manually and I realized that the custom list I made doesn't show up when she opens the workbook.
So I did some googling and added a line to the macro to create the same custom list before my initial code:
Code:
Application.AddCustomList ListArray:=Array("PROJECT CANCELLED", "STAGE 1 - PI", "STAGE 2 - RD", "STAGE 3 - W", "STAGE 4 - LV", "STAGE 5 - LD", "PROJECT COMPLETE")
Any help anyone can provide would be appreciated.
Thanks!
Lindsay