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

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
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,224,828
Messages
6,181,210
Members
453,023
Latest member
alabaz

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