2016-03-19

Having trouble with adding or deleting rows manually, would be great to do this by vba (which I have no experience of)

I feel that I have to try to specify as good as I can what I would like the codes to do (four different types of codes):

ADDING

Adding copies of row 1 on active sheet:

1) Dialog box asks how many new copies of row 1 on active sheet that I want

2) New dialog box asks to select a row with mouse where the copies shall be inserted.

3) If step 1 or 2 is cancelled, do not insert rows or display any error message

4) If selected row is less than row number 6 (that is row number 1-5), a dialog box tells it is not possible to add copies here. Code ends.

5) If selected row is more than the row number that contains the word "maximum", a dialog box tells it is not possible to add copies here. Code ends.

6) Otherwise, password is unprotected, code executed and password protected again.

Adding copies of row 1 on similar multiple sheets:

1) Dialog box asks how many new copies of row 1 on each of three sheets A, B and C that I want

2) New dialog box asks to select a row with mouse where the copies shall be inserted.

3) If step 1 or 2 is cancelled, do not insert rows or display any error message

4) If selected row is less than row number 6 (that is row number 1-5), a dialog box tells it is not possible to add copies here. Code ends.

5) If selected row is more than the row number that contains the word "maximum", a dialog box tells it is not possible to add copies here. Code ends.

6) Otherwise, password (same on all sheets) are unprotected, code executed (copies of row 1 inserted on same row of each sheet) and password protected again.

DELETING

Deleting rows on active sheet:

1) Dialog box asks me to select with mouse what rows I want to be deleted

2) If cancelled, do not delete rows or display any error message.

3) If selected row is less than row number 6 (that is row number 1-5), a dialog box tells it is not possible to delete rows here. Code ends.

4) If selected row is more than the row number that contains the word "maximum", a dialog box tells it is not possible to delete these rows. Code ends.

5) Otherwise, password is unprotected, code executed and password protected again.

Deleting rows on multiple sheets:

1) Dialog box asks me to select with mouse what rows I want to be deleted

2) If cancelled, do not delete rows or display any error message.

3) If selected row is less than row number 6 (that is row number 1-5), a dialog box tells it is not possible to delete rows here. Code ends.

4) If selected row is more than the row number that contains the word "maximum", a dialog box tells it is not possible to delete these rows. Code ends.

5) Otherwise, passwords are unprotected (same on all sheets), code executed (same row numbers deleted on all sheets) and password protected again.

Show more