How to Protect Columns with Password in Excel (4 Ways)

If you are looking for ways to protect columns in Excel with a password, then this article will be helpful. By protecting your desired columns, you will keep the data in those columns secured from changing by other people. So, let’s dive into the main article.

Here, we have the following dataset containing the records of selling prices, cost prices, and corresponding profits of the products of a company. By using the following 4 methods we will try to protect different columns with a password according to our needs.

protect columns in Excel with password

We have used Microsoft Excel 365 version here, you can use any other version according to your convenience.


1. Use Format Cells Option to Protect Columns with Password in Excel

Here, we will protect the Selling Price, and Cost Price columns with a password by using the Format Cells and Protect Sheet options.

protect columns in Excel with password

Steps:
➤ Select the whole sheet by clicking on the triangle symbol in the top left corner and then go to the Home tab >> Cells group >> Format dropdown >> Format Cells option.

Format cells option

The Format Cells dialog box will appear.
➤ Click on Protection >> Uncheck the Locked option >> Select OK.

Format cells option

Now, we will do that process again for the cells that we want to lock.
➤ Select the columns; Selling Price, and Cost Price, and then go to the Home tab >> Cells group >> Format dropdown >> Format Cells option.

protect columns in Excel with password

The Format Cells dialog box will appear again.
➤ Click on Protection >> Check the Locked option >> Select OK.

Format cells option

It’s time to protect this sheet with a password to lock our desired columns.
➤ Go to the Home tab >> Cells group >> Format dropdown >> Protect Sheet option.

Format cells option

After that, the Protect Sheet wizard will pop up.
➤ Type the password and press OK.

protect columns in Excel with password

➤ Retype the password and press OK again.

Format cells option

As a result, our selected columns will be secured now, so to change any of the cell’s values of the Selling Price, and Cost Price columns you will get the following error message.

Format cells option

Read More: How to Protect Columns in Excel without Protecting Sheet


2. Using Allow Edit Ranges Option to Protect Columns with Password

In this section, we are going to use the Allow Edit Ranges option along with the Protect Sheet option to keep safe the Selling Price and Cost Price columns from unwanted changes with a password.

protect columns in Excel with password

Steps:
First, we will work with the columns which we can change even after protecting the sheet.
➤ Go to the Review tab >> Protect group >> Allow Edit Ranges option.

Allow Edit Ranges Option

Next, the Allow Users to Edit Ranges dialog box will open up.
➤ Click on the New option.

protect columns in Excel with password

➤ Name the Title box as two ranges or any other thing you want and type the ranges $B$4:$B$11, $E$4:$E$11 in the Refers to cells box and press OK.

Allow Edit Ranges Option

The Allow Users to Edit Ranges dialog box will appear again.
➤ Click on Apply.

Allow Edit Ranges Option

➤ Select the Protect Sheet option.

Allow Edit Ranges Option

The Protect Sheet wizard will pop up.
➤ Type the password and press OK.

Allow Edit Ranges Option

➤ Retype the password and press OK again.

protect columns in Excel with password

In this way, we have protected the Selling Price, and Cost Price columns, so to change any of the cell’s values of these columns the following error message will pop up.

Allow Edit Ranges Option


3. Protecting Columns in Excel with Formulas

Here, we will protect the column with formulas only, and here we have a formula used in the Profit column to get the profits by subtracting the selling prices from the cost prices.

protect columns in Excel with password

Steps:
➤ Select the whole sheet by clicking on the triangle symbol in the top left corner and then go to the Home tab >> Cells group >> Format dropdown >> Format Cells option.

Protecting columns with columns

The Format Cells dialog box will appear.
➤ Click on the Protection tab >> Uncheck the Locked option >> Select OK.

Protecting columns with columns

Now, we will do the same process for the column with formulas and select those cells using this process.
➤ Go to the Home tab >> Editing group >> Find & Select dropdown >> Go To Special option.

protect columns in Excel with password

The Go To Special dialog box will open.
➤ Click on the Formulas option, and press OK.

Protecting columns with columns

Then, you can see that the cells with formulas have been selected.

Protecting columns with columns

Open up the Format Cells dialog box by pressing CTRL+1.
➤ Click on the Protection tab >> Check the Locked option >> Select OK.

protect columns in Excel with password

It’s time to protect this sheet with a password to lock the Profit column with formulas.
➤ Go to the Home tab >> Cells group >> Format dropdown >> Protect Sheet option.

Protecting columns with columns

After that, the Protect Sheet wizard will pop up.
➤ Type the password and press OK.

Protecting columns with columns

➤ Retype the password and press OK again.

Protecting columns with columns

In this way, we have secured the Profit column with a password containing formulas so that for trying to change any cell of this column you will get an error message.

protect columns in Excel with password


4. Applying VBA Code to Protect Columns in Excel with Password

Here, we will use a VBA code to protect the Selling Price, and Cost Price columns from changing by using a password.

protect columns in Excel with password

Steps:
➤ Go to the Developer tab >> Visual Basic option.

VBA Code

Then, the Visual Basic Editor will open up.
➤ Go to the Insert tab >> Module option.

VBA Code

After that, a Module will be created.

VBA Code

➤ Write the following code in the module.

Sub secure_column()
Dim chng_rng1, chng_rng2 As Range
Set chng_rng1 = ActiveSheet.Range("B4:B11")
Set chng_rng2 = ActiveSheet.Range("E4:E11")
chng_rng1.Locked = False
chng_rng2.Locked = False
ActiveSheet.Protect Password:="1234"
End Sub

Here, we have declared chng_rng1 and chng_rng2 as Range, then assigned chng_rng1 to the range B4:B11, chng_rng2 to the range E4:E11.
After that, we have unlocked these ranges which means you can change these ranges even after protecting the sheet. Then, using a simple password the sheet has been protected and so our desired columns will also be protected with this password.

protect columns in Excel with password

➤ Press F5.
In this way, we have secured the Selling Price and Cost Price columns. Changing any value of these columns, the following error message will appear.

VBA Code


Practice Section

For doing practice by yourself we have provided a practice section like below in a sheet named Practice. Please do it by yourself.

Practice


Download Workbook


Conclusion

In this article, we tried to cover the ways to protect columns in Excel with a password. Hope you will find it useful. If you have any suggestions or questions, feel free to share them in the comment section.


Related Article


<< Go Back to Protect Excel Columns | Excel Protect | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Tanjima Hossain
Tanjima Hossain

TANJIMA HOSSAIN is a marine engineer who enjoys working with Excel and VBA programming. For her, programming is a handy, time-saving tool for managing data, files, and online tasks. She's skilled in Rhino3D, Maxsurf C++, MS Office, AutoCAD, and Excel & VBA, going beyond the basics. She holds a B.Sc. in Naval Architecture & Marine Engineering from BUET and is now a content developer. In this role, she creates tech-focused content centred around Excel and VBA. Apart from... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo