UserInterfaceOnly - protection not recognised?

LORDMARKS

New Member
Joined
Jun 5, 2014
Messages
39
Hi All

I allway write all my code in lowercase, so that when it capitalises I know I have spelt it correctly. However I have been looking for a better way to protect my workbook to avoid the endless looping. And found the UserInterfaceOnly property which seems to state it will allow VBA even when the sheet is protected.

My idea was to add this to my Workbook Open event and remove my 'unprotect' & 'protect' codes form all my other slow codes.

as you can see below, the statement does not autocapitalise or appear to be working (no errors though)

Code:
Dim ws As Worksheet
Dim pwd As String
pwd = "1973"
For Each ws In Worksheets
    ws.Protect Password:=pwd, userinterfaceonly:=True, AllowFiltering:=True
Next

Has anybody used this before? and has any idea how to fix?

Cheers
 

Some videos you may like

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
35,503
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
It doesn't autocapitalise (I don't know why, it just doesn't). It's also not 100% effective - what is it failing on for you?
 

Watch MrExcel Video

Forum statistics

Threads
1,108,984
Messages
5,526,060
Members
409,682
Latest member
HisHailo

This Week's Hot Topics

Top