Macro working in windows 10 but not windows 7

LLPlates

Board Regular
Joined
Jul 13, 2012
Messages
84
Hello,
I have recorded a macro to sort each column alphabetically in a workbook.
It works perfectly on our 2 computers that are windows 10 but not on the
windows 7 computer. Below is the macro.

Is this a common problem?

Sub SuburbSort()
'
' SuburbSort Macro
'

'
Columns("A:A").Select
ActiveWorkbook.Worksheets("TO DO LIST").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("TO DO LIST").Sort.SortFields.Add2 Key:=Range("A1") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("TO DO LIST").Sort
.SetRange Range("A2:I147")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A2").Select
End Sub

Regards,
LLPlates
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
What version of Excel do you have on the windows 7 computer?
 
Upvote 0
Debug your code and highlight where it fails

16 will have different syntax to 10, same goes for x64 (horrid VBA that has) again differences

If your going to program VBA in Office x86 all the way !
 
Upvote 0
Remove the 2 after add on this line
Code:
ActiveWorkbook.Worksheets("TO DO LIST").Sort.SortFields.Add[COLOR=#ff0000]2 [/COLOR]Key:
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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