Greetings to everyone. For the last few years I have been volunteering my time to develop an application to keep track of and calculate the results of a cross country meet for a large number of schools. Bit by bit and with help from this forum, I have been able to write the necessary macros to do the job and they work perfectly in Excel 2010. I'm sure that the design of the macros can be improved, but they do work as they are written in Excel 2010. There are 10 modules, two userforms and several macros in ThisWorkbook. Each worksheet code module also has a macro. If I step through the macros in Excel 2013, they seem to work fine but when I click the buttons on each worksheet to run the macros in Excel 2013, errors are generated. If someone has the time to have a look at my problem, I would really appreciate it. The sheets are protected with "password". Please click here to download the file. I will gladly supply and additional information you may need. Many thanks in advance.
Also posted at these links:
http://www.mrexcel.com/forum/excel-qu…cel-2012-a.html
http://www.excelforum.com/excel-programm…tml#post4119953
Macros work perfectly in Excel 2010 but generate some errors in Excel 2013
-
-
-
Re: Macros work perfectly in Excel 2010 but generate some errors in Excel 2013
Isn't the dtPicker control not available in 2013 ...?
-
Re: Macros work perfectly in Excel 2010 but generate some errors in Excel 2013
Not tested anything yet, but straight away in Module1 I can see error highlighting on "Exit password" - this isn't a valid statement so not sure what it's supposed to be doing?
Didn't notice cytop's post - I'm using 2010 and have the MSCOMCT2 dll so didn't pick up on the issue either!
-
Re: Macros work perfectly in Excel 2010 but generate some errors in Excel 2013
cytop: I've added the dtPicker so that part is working properly.
@SO: That "Exit password" shouldn't be there. I'm not sure how it got there to be honest.Thank you both for the quick responses.
-
Re: Macros work perfectly in Excel 2010 but generate some errors in Excel 2013
I thought I would respond to try and bring anyone viewing this thread up to date. First of all, I would like to thank Michael M. for his help and suggestions and the time he took to look at my file. I managed to trace the problem when running the macro in Excel 2013 to some code that unprotected a few sheets in the workbook. For some reason, this unprotecting action caused another sheet in the workbook to become active. Since the original sheet that was active when the macro was run was no longer the active sheet, errors were generated. I fixed the problem by forcing the active sheet to remain active using this code:
CodeDim ActSh As String ActSh = ActiveSheet.Name Sheets("Sheet1").Unprotect Password:="password" Sheets("Sheet2").Unprotect Password:="password" Sheets(ActSh).Unprotect Password:="password" Sheets(ActSh).Activate
I have no idea why a different sheet was activated especially since the macro ran perfectly in Excel 2010. It couldn't have been any previous code because the unprotecting was done at the beginning of the macro. I did some research into the problem and I was able to find another person who experienced the same problem. I'm wondering if it could be a glitch in Excel 2013. Another issue I discovered was that Microsoft strengthened the security on sheet protection in Excel 2013 so that passwords cannot be so easily broken. Unfortunately, if a macro protects and unprotects sheets several times in a macro, the macro runs extremely slowly because of the new algorithm to protect and unprotect sheets. In Excel 2010, my macros ran almost instantaneously whereas in Excel 2013, it took around 20 seconds or more for them to run. Hopefully, Microsoft will do something about this problem in the near future. If anyone has some insights into these problems, I would appreciate their input. Thank you and again many thanks to Michael M. By the way, in answer in the pervious post, the "Exit password" should have been "Exit sub".
-
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!