PDA

View Full Version : Worksheet edit VBA code



gsxr4fg
11-01-2017, 05:24 AM
Team, I am trying to build a VBA code that will allow rows to be added to a worksheet, but not allow the rows to be deleted

Many thanks

Kenneth Hobs
11-01-2017, 07:59 AM
Welcome to the forum! Please make your future subject lines more descriptive. e.g. Allow row insertion but not row deletion.

You can't have all of your cake. You can have a slice though.

1. Protect your worksheet using the UserInterfaceOnly:=True option.
2. Make sure that at least one cell in each row is locked, the default.
3. Make a Sub to Insert at the selected range by EntireRow(s). You will have to decide what options to use for the Insertion. Record a macro to see the syntax.

Of course if they insert and then decide they shouldn't have, it might not be a good thing.

Post back if you are still stuck.