How to protect cells in a spreadsheet while automatically filling in info with VBA?
I’m trying to create an excel workbook (in Excel 2007) that allows for a user to scan in a barcode and their information and the time automatically appears. I’ve got all that working, however there’s a couple more things I’d like to add:
1. I’d like to be able to protect the cells from the user, but still allow excel access to modify them. Ie, the user can’t simply go in and type something in that cell, but my VBA macro can.
2. Everything crashes spectacularly when a row or column is deleted or inserted. How can I make it so that the user cannot access the delete function from the right click menu?
I’ve tried using the standard "protect worksheet" function on the ribbon with all the cells locked except those needed to enter in the barcode, but this creates a 1004 runtime error. I do already have all sorts of error handlers for 1004 runtime errors, so I’m assuming this one is rather grave and can’t simply be passed over, presumably because the worksheet protection is saying that those cells can’t be modified. Is there a way (preferably in VBA) for me to protect a certain range of cells *and* also prevent the user from having the ability to delete/insert rows/columns?
Thanks! I’ll post my code if anyone wants to see it.
Editor’s comment
If you need to recover a lost or forgotten password for a Microsoft Office document, database or spreadsheet…Click Here to download your password recovery software

