I am setting up a one touch solution via a form control to sort subtotal, copy and paste information from one workbook to another for multiple users.
Whenever I use my form control it works like a dream, but once a different user saves the files exactly as named and attempts to run the code through the form control I receive an error. The error is being thrown from the last statement in the code below. x.Sheets("APHub").Sort.SortFields.Add2 Key:=Range( _"C2:C42524"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _ xlSortNormal
The error they are receiving is a 438 run-time stating “the object doesn’t support this property or method”
I have tried defining the worksheet as an object but it didn't correct it.
Dim x As Workbook
Dim y As Workbook
xName = "Missing_Merch.xlsx"
xNamePath = ThisWorkbook.Path & "\" & xName
Set x = Workbooks(xName)
Cells.Select
x.Sheets("APHub").Activate
Cells.Select
Cells.EntireColumn.AutoFit
Columns("F:I").Select
Selection.Cut
Columns("C:C").Select
Selection.Insert Shift:=xlToRight
Cells.Select
Selection.AutoFilter
x.Sheets("APHub").Sort.SortFields.Clear
x.Sheets("APHub").Sort.SortFields.Add2 Key:=Range( _
"C2:C42524"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _ xlSortNormal
This should start off my sorting sequence before any necessary subtotaling takes place.