UserInterfaceOnly Not Working

frank_AL

Active Member
Joined
Oct 30, 2015
Messages
467
I have a program I developed where several of the spreadsheets are protected. I had been using the UnProtect/Protect method in my code but was having a problem with sequencing with this method that was causing my code to fail. I researched online and discovered the UserInterfaceOnly option. I added code to the Workbook_Open() module for the specific Worksheets that needed to be Protected but hopefully would allow my programming modules to work.

Here are the lines of code in the Workbook_Open() module that set the protection:
Sheets("Customer Report Controls").Protect Password:="WtMaster", UserInterFaceOnly:=True
Sheets("Control Limits").Protect Password:="WtMaster", UserInterFaceOnly:=True
Sheets("Setup").Protect Password:="WtMaster", UserInterFaceOnly:=True
Sheets("Setup Controls").Protect Password:="WtMaster", UserInterFaceOnly:=True

I manually checked the Worksheets after adding this code and each of the listing Worksheets are protected as expected.
I am trying to access a cell on the "Setup" Worksheet that has a Range name of "Date_Format"
The program fails when the following line of code attempts to execute:
Application.Goto Reference:="Date_Format"
The error I receive is:
Run-time error '1004':
Method "Goto' of object '_Application' failed

I can manually Unprotect the "Setup" Worksheet and the code runs without a problem.

I have spent a good bit of time trying to research the issue to no avail. I really don't want to go back and UnComment all my Unprotect and Protect code if at all possible!

Let me know if anyone can help.
 
Last edited:

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
That code should be
Code:
Application.Goto Reference:=Range("Date_Format")

Mike, thank you for your quick response. I certainly hoped that the solution would be something so simple but after making the change I still get the same error.
As information, I am a relative newbie but I have used the "Application.Goto Reference:=" extensively throughout my code without using Range and it works fine.

So, any other ideas?

Thanks again.
 
Upvote 0

Forum statistics

Threads
1,215,343
Messages
6,124,400
Members
449,156
Latest member
LSchleppi

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