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

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
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,215,373
Messages
6,124,544
Members
449,169
Latest member
mm424

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