VBA that worked in Mac 2011

Russk68

Well-known Member
Joined
May 1, 2006
Messages
589
Office Version
  1. 365
Platform
  1. MacOS
Hello All,

This macro worked great in Excel mac 2011 but does not work in the current version. It actually crashes Excel so it cant be debugged. It would print all the pages of each sheet in my workbook. Can some explain why it no longer works and how to fix it?



Sub prtme()
Dim Answer As VbMsgBoxResult
Answer = MsgBox("Are you sure!", vbOKCancel, "Print Workbook")
If Answer = vbOK Then
Dim cRng As Range
For Each cRng In Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row)
If cRng.Offset(0, 1).Value > 0 Then
Sheets(cRng.Value).PrintOut From:=1, To:=cRng.Offset(0, 1).Value, Copies:=1
End If
Next
End If
End Sub

Thank you!

Russ
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi Russk68,

It works for me :confused:

The fact that it works for me and did work for you tends to tell me that there's an issue with the new version on Excel that you're using. Can you reload it?

Robert
 
Upvote 0
Hi Robert,

Did you try it on Excel for Mac? I just updated to 16.23 and it still crashes on me.

Thanks!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,563
Messages
6,114,332
Members
448,566
Latest member
Nickdozaj

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