VBA to delete rows with protected columns

lmmay

Board Regular
Joined
Jun 6, 2014
Messages
87
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?
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
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.
 
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0
Solution

Forum statistics

Threads
1,214,523
Messages
6,120,038
Members
448,940
Latest member
mdusw

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
Back
Top