There are differences in VBA between different versions of Office.
Compatibility issues arise when the objects used by VBA programs are uncertain, such as different operating system environments, office environments, and worksheet objects.
In general, lower versions of macros cannot run in higher versions of macros, and some statements have been written differently.
I recommend that you copy macro statements to the new version of the environment to run sentence by sentence to debug.
If you're having trouble debugging, you can refer to the link provided by DSPatrick and go to the appropriate forum to ask questions about your code.
Good luck.😊
If the response is helpful, please click "Accept Answer" and upvote it.