VBA to delete rows with protected columns

lmmay

Board Regular
Joined
Jun 6, 2014
Messages
78
I have a sheet in a workbook with protected columns. I would like to enable the user to delete 1 or more rows. I need to unprotect the sheet, select rows to be deleted then protect the sheet automatically when the rows are deleted. I use a macro to unprotect the workbook and a macro to protect. How can I do the row deletion?
 

Some videos you may like

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Zot

Well-known Member
Joined
Nov 26, 2020
Messages
983
Office Version
  1. 2016
Platform
  1. Windows
I'm not sure what was your problem since you use macro to unprotect and protect.

So, after unprotect just delete the row normally using either
Worksheets.Rows(Row#).Delete
Range(“
Cell”).EntireRow.Delete

After that just protect again.
 

lmmay

Board Regular
Joined
Jun 6, 2014
Messages
78
I'm not sure what was your problem since you use macro to unprotect and protect.

So, after unprotect just delete the row normally using either
Worksheets.Rows(Row#).Delete
Range(“
Cell”).EntireRow.Delete

After that just protect again.
Thanks. I want to unprotect a single sheet, perform the delete, then protect the sheet automatically. I don't want the user to have other access.
 

Zot

Well-known Member
Joined
Nov 26, 2020
Messages
983
Office Version
  1. 2016
Platform
  1. Windows
How is your approach?
1) Run macro and Protect Dialog box popped up. User key in password to unlock. Delete row manually. Run macro and Protect Dialog box popped up. User key in password to lock. Well this can be done manually also :)

2) Run macro and automatically unprotect. Delete row manually. Run macro to automatically protect. In this case. if any person know how to execute that macro will have access without knowing password.
 
Solution

lmmay

Board Regular
Joined
Jun 6, 2014
Messages
78
I will have the user send me the workbook if rows need deleting.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,372
Messages
5,624,301
Members
416,018
Latest member
mirceaon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top