Hi,
I want to allow users to delete rows from a protected worksheet.
The rows contains locked cells, and therefor this causes problems.
Is there a "work-around" to solve this problem?
Hi,
I want to allow users to delete rows from a protected worksheet.
The rows contains locked cells, and therefor this causes problems.
Is there a "work-around" to solve this problem?
The first issue may be a design problem. There is a contradiction in locking cells vs. allowing users to delete the rows. Why are they locked if you want to allow deletion?
Anyway, the workaround is to write a macro that unprotects the sheet, deletes the row, then re-protects the sheet. This is for protection without a password.
If locked with a password then you have to explicitly put the password in the code. Then if you want to hide the code you have to password-protect it.![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
Hi,
Regarding the design problem, is it not a "problem".
The users tend to delete formulars, eventhoug they are told not to, but since its a tool for them to work in, they should be allowed to delete rows.
If i put in the macro, how does I make it run automaticly when they are trying to delete the row - is there a call, or do I have to overwrite the commando ctrl + "-"?
Thanks
Needing to do something that Excel was designed to prevent sounds like a problem to me.
CTRL + - deletes the contents of cells if the entire row is selected, which isn't what you want. If you do not have a row selected, CTRL + - brings up a dialog which asks what you're trying to delete, which may still not be what you want. In any case, to assign a hotkey to a macro you have to use a letter, so you can't override CTRL + -.
The way I would do this is to provide a Delete Row button on the worksheet that executes the DeleteSelectedRow Sub. Or you could select a letter. Letters that Excel does not already use are E, J, M, Q, although you could reassign one already in use.
Sounds like a good solution with the button.
Thanks.
The code worked fine.
What if I want to cut or copy a row in one protected sheet and paste or insert the cuted cells in another protected sheet. Is that possible?
Thanks again.
It's possible, but you similarly have to unprotect and reprotect the destination sheet to do the paste. The code isn't hard--the "interesting" part is designing how this process should work from the user's point of view.
Hi,
The solution will be the same as the other one.
I am planning to create some buttons when this is needed.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks