Try using
Worksheet.Protect "Password", UserInterfaceOnly := True
If the UserInterfaceOnly
parameter is set to true, VBA code can modify protected cells.
Note however that this parameter does not stick. It needs to be reapplied each time the file is opened.
Related Contents:
- Loop through files in a folder using VBA?
- Excel column number from column name
- Is it possible to write Excel VBA Code in Visual Studio
- Removing the password from a VBA project
- How to check for empty array in vba macro [duplicate]
- How to continue the code on the next line in VBA
- Use of symbol # (hash) in VBA Macro
- How can I color dots in a xy scatterplot according to column value?
- How to wait until ActiveWorkbook.RefreshAll finishes before executing more code
- Determining the full type of a variable
- Levenshtein Distance in VBA [closed]
- What does the Excel range.Rows property really do?
- How can I generate GUIDs in Excel?
- Programmatic Access To Visual Basic Project Is Not Trusted
- vba: get unique values from array
- How to “flatten” or “collapse” a 2D Excel table into 1D?
- How do I get the old value of a changed cell in Excel VBA?
- Delete Sheets and avoid Excel asking the user to confirm, using custom messages instead
- Get User Selected Range
- Relative instead of Absolute paths in Excel VBA
- Getting Excel to refresh data on sheet from within VBA
- Quickest way to clear all sheet contents VBA
- How can I programmatically freeze the top row of an Excel worksheet in Excel 2007 VBA?
- Excel: macro to export worksheet as CSV file without leaving my current Excel sheet
- Execute a command in command prompt using excel VBA
- Repeated calls of Chart.SetSourceData give error 1004
- VBA Runtime Error 1004 “Application-defined or Object-defined error” when Selecting Range
- What is the function of FormulaR1C1?
- Put Excel-VBA code in module or sheet? [closed]
- How to get the path of current worksheet in VBA?
- When editing Microsoft Office VBA, how can I disable the popup “Compile error” messages?
- How to create and write to a txt file using VBA
- Break out of a While…Wend loop
- Microsoft Excel ActiveX Controls Disabled?
- Parsing an ISO8601 date/time (including TimeZone) in Excel
- Check if the file exists using VBA
- Open Excel file for reading with VBA without display
- Creating an Array from a Range in VBA
- Continue For loop
- Determining whether an object is a member of a collection in VBA
- Are ActiveX Controls Disabled?
- How can I find last row that contains data in a specific column?
- Read/Parse text file line by line in VBA
- Create excel ranges using column numbers in vba?
- Loop through each cell in a range of cells when given a Range object
- VBA to copy a file from one directory to another
- VBA Check if variable is empty
- Is VBA an OOP language, and does it support polymorphism?
- VBA check if file exists
- Open an html page in default browser with VBA?