A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
What you said suggests the code is using a deprecated feature and needs to be re-written for current Excel.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I purchased Office 2021 Home & Business version for my MAC OS X Big Sur version 11.6 device. I have an older Mac with El Capitan version 10.11.6 with Excel for Mac 2011 version 14.7.2 (120228) and my macro runs perfectly my El Capitan MAC. No errors but with the above 2021 version this happens when I run it. My thinking is the VBE for 2021 is not compatible. That being it is running Visual Basic for Applications 7.1 a 2012 version. Here is the error that appears with this VBA version on 2021:
Error Signature:
Exception: EXC_BAD_ACCESS
ExceptionEnumString: 1
Exception Code: KERN_INVALID_ADDRESS (0x0000000000000000)
Date/Time: 2021-12-07 14:14:27 +0000
Application Name: Microsoft Excel
Application Bundle ID: com.microsoft.Excel
Application Signature: XCEL
Application Bitness: x64
Application Version: 16.55.0.21111400
Crashed Module Name: Microsoft Excel
Crashed Module Version: 16.55.21111400
Crashed Module Offset: 0x0000000001360b80
Blame Module Name: Microsoft Excel
Blame Module Version: 16.55.21111400
UnsymbolicatedChecksum: F8964BC838218A2607807E3723436B98
Blame Module Offset: 0x0000000001360b80
StackHash: 79e9d5cb3057b8cf-dm_1_main_arm
Application LCID: 1033
Extra app info: Reg=en Loc=0x0409
Build Type: Release
Crashed thread Stack Pointer: 0x_000000016fbebb70
Crashed thread: 0
25 Threads occur next.
OS Information
Operating System: Mac OS X 11.6 (Build 20G165)
CPU: ARM64e, Logical CPU Count: 8
Physical Memory: 16384 MB
Device_model: MacBookPro17,1
Screen: 1440.000000 x 900.000000, bitsPerPixel = 24, frame = 0.000000, 0.000000, 1440.000000, 900.000000
CrashedApp_Virtual_Memory_Size_MB: 401109.000000
CrashedApp_Resident_Memory_Size_MB: 402.000000
CrashedApp_Memory_Footprint_MB: 259.000000
ErrorReportingDeviceUUID: E734B9E6-6F50***********D520585
ErrorReportingUUID: 11E68F52-982C-4A0E*******CAD901023
ULS UUID: D54B6D4B-6DB2-********D3DD4821F
CrashedLogSessionId: D54B6D4B-6DB2-4EA*****108D3DD4821F
TimeFromLaunch: 0 hours, 0 minutes, 29 seconds
CrashedSessionDuration: 29
Total errors on this client: 27
Microsoft Application Information:
Audience: Production
SHSuffixKey_0: _arm
AudienceChannel: CC
AudienceGroup: Production
[Some related PII has been masked by Mia Zhao MSFT Support to protect your privacy.]
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
What you said suggests the code is using a deprecated feature and needs to be re-written for current Excel.
Hi,
Performed all three steps above to no avail. My macro is pretty basic until a ColumnSort line. Which works perfectly on 2011 Excel with 2010 VB version 14.7.2 (120228). However, 2021 uses 2012 VB 7.1. My assessment is Devs didn’t do a lot of macro testing with the two to ensure VB 7.1 was compatible with Excel. 2021. Basic macros and VBA code will perform. Its when an intricate line of code with a “=“ of two ColumnSort routines tests the capability of the the app platform that the real test results occur. BTW I can actually place a break on this line with the old 2011 Excel and see the same error screen. But when it is removed it performs flawlessly. So the new edition 2021 doesn’t allow passing of this same functional equation with this newer Excel platform VB compiler.
Hi
It appears that the row number must be specified for D.
This works as expected:
Sub test()
Dim NumOfRows As Integer
NumOfRows = ActiveSheet.Range("A2:D10").End(xlUp).Rows
MsgBox NumOfRows
End Sub
One problem as I said originally is that the VBE compiler is not compatible with 2021 Excel. MS cannot simply create a new Excel edition without updating a compiler. The 2011 edition of Excel the original code performs without any run-time or object errors. Rewriting code is also producing now object errors even from code from MS VBA developers. Run this code with a CSV file and you will see the last line of code from a MS VBA developer now produces an object error. I am including my commented out code of which original ran on 2011.
Dim sd As Worksheet, rd As Range, filespec As Variant, wbOpen As Workbook, rdSheet As Worksheet, wkshtdest As Worksheet, wb As Workbook, ColumnSort As Long, NameFolder As String, xtitleid As String, newName As Variant
NameFolder = "downloads folder"
Set sd = ThisWorkbook.Sheets(strResponse)
If strResponse = " " Then
Exit Sub
End If
Set rd = sd.Range("A2:F300")
filespec = Application.GetOpenFilename()
Set wbOpen = Workbooks.Open(Filename:=filespec) ' ORIGINAL
xtitleid = "Change To s1"
newName = Application.InputBox("Name", xtitleid, "", Type:=2)
Application.Sheets(1).Name = newName
Sheets("s1").Activate
Set rdSheet = wbOpen.Sheets("s1")
rdSheet.Columns(6).EntireColumn.Delete
ColumnSort = rdSheet.Cells(Rows.Count, 2).End(xlUp).Row
‘rdSheet.Range("A2:D" & ColumnSort).Sort Key1:=Range("A2:A" & ColumnSort), order1:=xlDescending, Header:=xlNo
rdSheet.Range("A2:D").Cells(Rows.Count, 2).End(xlUp).Row
Hi,
Sorry for all the inconveniences it may have caused on your side.
Based on the description, it seems like the issue started because you have updated the Excel environment from Office 2011 to Office 2021. If so, as the Excel version has changed with a large difference/update, the possibility of the incompatible as your guess is reasonable. Hence, I'd like to suggest some general steps to troubleshoot from the Excel side and if the issue persists, it is suggested to modify the codes in the issue macros.
1.Clean the Excel cache folder(No need to do this if the Excel is newly installed recently.)
Open Finder > press Command + Shift + G > input ~/Library/Containers, remove Microsoft Excel folder to the desktop. Then, reopen Excel and run the macros to check the behavior.
2.Run Mac in Safe Mode.
This can help us to exclude any possible influences from other third-party apps or background programs that may have a conflict with the Excel app. See: How to use a "clean startup" to determine whether background programs are interfering with Office for Mac (microsoft.com) and kindly refer to the Apple article in the last one to get detailed steps.
3.Create a new user profile. See: Set up users, guests, and groups on Mac - Apple Support
This is the last step to help us to locate the issue cause as if it persists in a new user profile, it is most likely that the error is caused by the macro side or let's say the incompatibility between the macro and the Office 2021 Excel 16.55 environment.
Besides, do feel free to let me know if the same error will even happen when you run some basic macros in Excel.
Best Regards,
Mia