One-click Encryption Excel worksheet formula

Source: Internet
Author: User
Tags exit password protection

Many of the data in the worksheet are generated by formula calculations, so how can you let others see the results of a calculation and hide the formula you use? Today we are going to introduce you to use macros to solve this problem.

First, create macros

Start Excel, select Tools-Macros-record new macros, enter the name of the macro in the open window, and set the save in item to personal Macro Workbook, and click OK to enter the macro recording mode. At this point we can see the macro Recording toolbar in the current window, click Stop Recording to exit the macro recording.

After exiting, press the "ALT+F11" key in Excel and select "VBAProject" in the Open VB editing window (PERSONAL. XLS) "-Module"-"Module 1", and then replace the contents of the right window with the following:

Sub password protection ()//Name of macro

ActiveSheet.Unprotect ("888888")//default password

Cells.select

selection.locked = False

Selection.specialcells (xlCellTypeFormulas, 23). Select

selection.locked = True

Selection.formulahidden = True

ActiveSheet.Protect ("123456")

Activesheet.enableselection = xlUnlockedCells

End Sub

After doing a good job to save the settings exit the editing window (Figure 1), in the actual operation of the need to change the default 888888 to their own password, so as not to cause leakage.

  Computer Tutorials Figure 1

Second, the application of macros

In Excel, open the Customize command on the Tools menu, and on the Commands tab, in categories, select Macros. Select Custom button in command and drag it onto the toolbar, click the button on the toolbar, select the macro name we created in the pop-up window, and save the settings.

At this point, we need to encrypt the only click the button, you can protect the current worksheet, and the default password is 888888, how to do this is convenient enough.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.