Protect Worksheet with UserInterfaceOnly still stopping code.

NickT33

New Member
Joined
Dec 30, 2017
Messages
13
Hello,

On my sheet I have tables I want users to be able to add / remove / edit data through a form, but have them protected from manual manipulation. After running Worksheets().Protect, UserInterfaceOnly:=True on Workbook_open() it allows my code to edit and remove items, but not add.

The problem seems arise on this line, right after I add a ListRow to the table when I try to add data:
Code:
tableRowMain.Range(1, 1).Value = txtDate

I get a Run-time error (1004): Application-defined or object-defined error.

Any help is appreciated.
 
UserInterfaceOnly is not 100% effective, unfortunately (it never has been), although I'm surprised you can add a new row but not write values to it. Perhaps try explicitly unlocking the cells in the new row first?
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
I too thought it was odd that there was no problem adding the listrow. If I'm going to unprotect the new row I might as well just do what Joe said and unprotect / protect the sheet at the start and end, I just hope it won't significantly slow down the code. Thanks for the input guys.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,329
Members
452,635
Latest member
laura12345

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