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

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,223,901
Messages
6,175,277
Members
452,629
Latest member
SahilPolekar

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