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: 11
Last edited by a moderator:

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
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".
 
Upvote 0
Solution
Thank you for your quick response - I'll give it a crack and report back!
 
Upvote 0
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
 
Upvote 0
You are welcome and thanks for the feedback. Hopefully your presumption turns out to be correct.
 
Upvote 0

Forum statistics

Threads
1,214,665
Messages
6,120,804
Members
448,990
Latest member
rohitsomani

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