Sort not working

colinharwood

Active Member
Joined
Jul 27, 2002
Messages
426
Office Version
  1. 2019
Platform
  1. Windows
Hi
I have the following code in a macro, which I recorded, in a worksheet which works fine on my PC. I have now given the workbook to a friend, and he gets Run-time error'438': Object doesn't support this property or method at the lines in red. Could anyone explain why please.
Thanks

Code:
 'sort alphabeticaly
      Range("R10:T130").Select
    ActiveWorkbook.Worksheets("PDF Membership Card").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("PDF Membership Card").Sort.SortFields.Add2 Key:= _
        Range("S10:S130"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
        :=xlSortNormal
    With ActiveWorkbook.Worksheets("PDF Membership Card").Sort
        .SetRange Range("R10:T130")
        .Header = xlGuess
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
 
Last edited by a moderator:

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I suspect your friend is running an older version of xl. Change the Add2 to Add
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0
When using this code, the default printer changes to "Microsoft print to PDF". Is there a way to get the previous default printer to use as a variable to reset the default printer after printing to Microsoft print to PDF.
Thanks
 
Upvote 0
Yes it is possible to do that, but as it's a totally different question, it needs a new thread. Thanks
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,549
Members
449,089
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top