{"id":4032,"date":"2024-02-03T06:55:30","date_gmt":"2024-02-03T06:55:30","guid":{"rendered":"http:\/\/www.learnexcelmacro.com\/wp\/?p=4032"},"modified":"2024-02-03T06:55:30","modified_gmt":"2024-02-03T06:55:30","slug":"protect-unprotect-sheet-using-vba","status":"publish","type":"post","link":"https:\/\/vmlogger.com\/excel\/2024\/02\/protect-unprotect-sheet-using-vba\/","title":{"rendered":"Excel Macro : Excel VBA code to Protect OR UnProtect Sheet"},"content":{"rendered":"

[et_pb_section fb_built=”1″ admin_label=”section” _builder_version=”4.16″ da_disable_devices=”off|off|off” global_colors_info=”{}” da_is_popup=”off” da_exit_intent=”off” da_has_close=”on” da_alt_close=”off” da_dark_close=”off” da_not_modal=”on” da_is_singular=”off” da_with_loader=”off” da_has_shadow=”on”][et_pb_row admin_label=”row” _builder_version=”4.16″ background_size=”initial” background_position=”top_left” background_repeat=”repeat” global_colors_info=”{}”][et_pb_column type=”4_4″ _builder_version=”4.16″ custom_padding=”|||” global_colors_info=”{}” custom_padding__hover=”|||”][et_pb_text _builder_version=”4.17.6″ _module_preset=”default” global_colors_info=”{}”]This is a small VBA code to help you in dealing with Protecting<\/strong> and UnProtecting<\/strong> the WorkSheet using Excel Macro. Assuming the fact here that you know How to Protect or UnProtect a Sheet using Excel In-Built function <\/i>. For those who do not know protect or unprotect the sheet using Excel inbuilt function, I will give a brief about the same at the end of this Article.<\/a><\/p>\n

Excel Macro to Protect your Sheet<\/h1>\n

To protect an Excel WorkSheet, Worksheet.Protect<\/strong> Method is used. Using this method you will be able to protect your WorkSheet. Let’s see the Syntax and How to use Worksheet Protect Method in Excel Macro.<\/p>\n

How to use Worksheet Protect Method in Excel Macro<\/h1>\n

Syntax:<\/h3>\n

Note: <\/strong> Like .PrintOut Method <\/strong><\/a> this method has all Optional parameters too.<\/p>\n

\nWorkSheet.Protect(Password, DrawingObjects, Contents, Scenarios, UserInterfaceOnly, AllowFormattingCells, AllowFormattingColumns, AllowFormattingRows, AllowInsertingColumns, AllowInsertingRows, AllowInsertingHyperlinks, AllowDeletingColumns, AllowDeletingRows, AllowSorting, AllowFiltering, AllowUsingPivotTables)<\/i><\/p>\n

Where:<\/h3>\n
\n\n\n
\n