TheRobster
Feb 12th, 2005, 01:38 PM
Hi all,
I'm just putting the finishing touches to an Excel application and have started to protect the worksheets using the security function so that users can only enter values into certain cells.
However, after doing this and then testing the worksheet I came across a very big problem! I have quite a lot of VBA code in this application that carries out a lot of calculations and then writes these to various worksheets. After I added the worksheet protection I found that whenever I try to run the VBA code I get errors stating in effect that the computer can't write the results of the VBA calculations to the worksheets as they are protected!
This is most annoying since I only want to stop the users from entering data in the wrong cells - I don't want to stop the computer from been able to write data into them!
In the Protect Worksheet options dialog box I've tried checking all the available options but it still can't write anything to the worksheet.
The only solution that I can think of is to go through the code to see which cells it's trying to change and then Unlock them all in the Protection dialog box. However this would be extremely inefficient as the application is large and was developed in an ad-hoc manner and so there are thousands of cells all over the place that need writing to.
Isn't there any way to allow the VBA code to write to a protected worksheet?
Thanks
-Rob
I'm just putting the finishing touches to an Excel application and have started to protect the worksheets using the security function so that users can only enter values into certain cells.
However, after doing this and then testing the worksheet I came across a very big problem! I have quite a lot of VBA code in this application that carries out a lot of calculations and then writes these to various worksheets. After I added the worksheet protection I found that whenever I try to run the VBA code I get errors stating in effect that the computer can't write the results of the VBA calculations to the worksheets as they are protected!
This is most annoying since I only want to stop the users from entering data in the wrong cells - I don't want to stop the computer from been able to write data into them!
In the Protect Worksheet options dialog box I've tried checking all the available options but it still can't write anything to the worksheet.
The only solution that I can think of is to go through the code to see which cells it's trying to change and then Unlock them all in the Protection dialog box. However this would be extremely inefficient as the application is large and was developed in an ad-hoc manner and so there are thousands of cells all over the place that need writing to.
Isn't there any way to allow the VBA code to write to a protected worksheet?
Thanks
-Rob