Macro that previously worked now fails on latest version of Excel 365 for Mac

MJ79

New Member
Joined
Sep 28, 2021
Messages
3
Office Version
  1. 365
Platform
  1. MacOS
I've used a macro for several years on an earlier version of Excel for Mac.
The Excel version was 2011, and the Macro looks like this:

Sub MOTM()
Dim ws As Worksheet, newWb As Workbook

Application.ScreenUpdating = False
For Each ws In Sheets(Array("6weekform", "MOTM"))
ws.Copy
Set newWb = ActiveWorkbook
With newWb
.SaveAs ws.Name & ".csv", xlCSVWindows
.Close (False)
End With
Next ws
Application.ScreenUpdating = True

End Sub

The Macro saved the workbook sheets "6weekform" and "MOTM" as two separate CSV files, keeping the original xlsm file separate.
Since recently moving to the new version of Excel 365 (16.53) for Mac (running Catalina 10.15.7), the Macro fails and produces this error:

Image

When I click on Debug, it highlights this part of the Macro:

Image

I can't find anywhere online that offers a solution for this, so any assistance any one can give me would be gratefully received.
I have several Macros like this one that used to produce dozens of CSV files from sheets, which I now have to individually manually save.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,214,951
Messages
6,122,446
Members
449,083
Latest member
Ava19

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