VBA Errors in Excel 2016

automationamateur

Board Regular
Joined
Jan 3, 2011
Messages
166
I was recently upgraded from Excel 2013 (32 Bit) to Excel 2016 (64 Bit) on windows 7 enterprise OS. Macros I have been using for years have all the sudden stopped working and erroring out on the oddest code. Any help is greatly appreciated, I'm not sure what I am missing. Thanks!

This existing code that is extremely simple and has worked for years now creates error, "Run-time error '-2147417848 (80010108)':Method 'Delete' of object' _Worksheet' failed"
Code:
Sheets("Sample Sheet").Delete

When I run macro recorder to accomplish the same task Excel 2016 now creates this:
Code:
Sheets("Sample Sheet").Select
ActiveWindow.SelectedSheets.Delete
 
Copy the sheet name from your errant code and paste it to a cell (let's say A1 for example). Then copy the sheet tab name from a sheet that can't be deleted from the 2013 code and paste it to another cell (say B1 for this example). Now in C1 enter: =EXACT(A1,B1)

What do you get? If FALSE, then in D1 enter: =LEN(A1) and copy it to E1. Does D1 differ from E1?

Sheet name is not the problem, I know its not because it works in 2013, if there was a mismatch it wouldn't work in excel 2013 either.
 
Upvote 0

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Sheet name is not the problem, I know its not because it works in 2013, if there was a mismatch it wouldn't work in excel 2013 either.
Can you invest a couple of minutes and try what I asked? That would confirm if sheet name is the problem.
 
Upvote 0
I did, it is true, it is the exact same. Let me add this for clarification: the only difference is excel 2013 vs 2016 (not a single other thing has changed). For example, my coworker still has 2013, i give him my workbook and the macro works fine on his machine as it has for years on both his and my machine. I use the exact same workbook/macro on my machine with excel 2016 and it fails.
 
Upvote 0
I did, it is true, it is the exact same. Let me add this for clarification: the only difference is excel 2013 vs 2016 (not a single other thing has changed). For example, my coworker still has 2013, i give him my workbook and the macro works fine on his machine as it has for years on both his and my machine. I use the exact same workbook/macro on my machine with excel 2016 and it fails.
Very strange - think I'll stick with Excel 2010 until a new version arrives.:)
 
Upvote 0

Forum statistics

Threads
1,216,079
Messages
6,128,687
Members
449,464
Latest member
againofsoul

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