Macros will not run on another machine

Aloysious

New Member
Joined
Apr 29, 2020
Messages
3
Office Version
  1. 2013
Platform
  1. Windows
Hi
I am creating a membership register for my sister in Queensland (Australia) and I live in Western Australia. All the macros are "recorded" as I'm not smart enough to write them myself. When I send it to her, and connect remotely to her machine it produces the error "Run time error 438 - object doesn't support this property or method". This occurs at the yellowed section of the attached screen shot. The code is:
VBA Code:
Sub Rpt_2013()
'
' Rpt_2013 Macro
' Report fin members 2013
'

'
    Range("H:H,J:AJ").Select
    Range("J1").Activate
    Selection.EntireColumn.Hidden = True
    Range("A2:I250").Select
    ActiveWindow.SmallScroll Down:=-250
    ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add2 Key:=Range("I3:I250") _
        , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add2 Key:=Range("A3:A250") _
        , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("Sheet1").Sort
        .SetRange Range("A2:I250")
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    Selection.PrintOut Copies:=1, Collate:=True
    Columns("G:AK").Select
    Range("G2").Activate
    Selection.EntireColumn.Hidden = False
    Range("A1:G1").Select
    Selection.EntireColumn.Hidden = False
End Sub

It is a register showing each year members from 2010 to 2040 and each macro runs a button appropriate for the year. The code merely hides unnecessary columns, sorts the membership data with "X" indicating member/non-member and then prints the sorted result - then returns and unhides the columns.

As I've said - I'm puzzled by this as it works well on my machine. I am running Excel 2019 and she an earlier version - likely 2010. We have enabled macros on her machine. Any help would be greatly appreciated.
 

Attachments

  • CaptureE.JPG
    CaptureE.JPG
    82.7 KB · Views: 4
Last edited by a moderator:

Some videos you may like

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

GWteB

Well-known Member
Joined
Sep 10, 2010
Messages
1,295
Office Version
  1. 2013
Platform
  1. Windows
Hi @Aloysious, welcome to MrExcel.

In the lines containing this snippet ..
VBA Code:
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add2

try replacing this snippet with
VBA Code:
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add

so changing the Add2 method to the Add method by removing the "2".
 
Solution

Aloysious

New Member
Joined
Apr 29, 2020
Messages
3
Office Version
  1. 2013
Platform
  1. Windows
Thank you for your quick response - I'll give it a crack and report back!
 

Aloysious

New Member
Joined
Apr 29, 2020
Messages
3
Office Version
  1. 2013
Platform
  1. Windows
Works like a charm on a laptop I have here. Presume it will work on my sister's machine also - thanks so much for your help
 

GWteB

Well-known Member
Joined
Sep 10, 2010
Messages
1,295
Office Version
  1. 2013
Platform
  1. Windows
You are welcome and thanks for the feedback. Hopefully your presumption turns out to be correct.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,248
Messages
5,600,535
Members
414,386
Latest member
PARAMATHMA SENTHILNATHAN

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
Top