Run-Time Error '438' - Object doesn't support this property or method

pacman14

New Member
Joined
Aug 22, 2014
Messages
2
Hi,

I'm getting a Run-Time Error '438' when trying to sort some data.

I've read some of the previous forums hinting at a compatibility issue between excel 2003 and 2007, but that isn't the case here.

The sample code is as follows (A few lines may look wired b/c I was testing out ways to make it work):

Code:
Sub TestMacro()
    ThisWorkbook.Worksheets("ListData").Activate
    ThisWorkbook.Worksheets("ListData").Range("M1").EntireColumn.Sort key1:=Range("M1"), order1:=xlAscending, Header:=xlYes
    
    ActiveWorkbook.Worksheets("ListData").Sort.SortFields.Clear
    ThisWorkbook.Worksheets("ListData").Range("C1").EntireColumn.Sort key1:=Range("C1"), order1:=xlAscending, Header:=xlYes
    
    ThisWorkbook.Worksheets("ListData").Sort.SortFields.Clear
    ThisWorkbook.Worksheets("ListData").Range("A1").EntireCoulmn.Sort.SortFields SortOn:=xlSortOnValues, key1:=Range("A1"), order1:=xlAscending, DataOption:=xlSortNormal, Header:=xlYes
    
    ActiveWorkbook.Worksheets("ListData").Sort.SortFields.Clear
    ThisWorkbook.Worksheets("ListData").Range("I1").EntireCoulmn.Sort key1:=Range("I1"), order1:=xlAscending, Header:=xlYes
End Sub


Columns M and C work fine. C only started working after I added the "Sort.SortFields.Clear" line of code.

Columns A and I refuse to cooperate.

Please help! :(
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Welcome to MrExcel.

You have a typo (in two places actually):

Rich (BB code):
ThisWorkbook.Worksheets("ListData").Range("A1").EntireCoulmn
 
Upvote 0

Forum statistics

Threads
1,215,178
Messages
6,123,484
Members
449,100
Latest member
sktz

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