excel表格锁定怎么解锁_让用户锁定或解锁Excel工作簿

excel表格锁定怎么解锁

Some people like an Excel workbook that's locked down, so they can't accidentally mess anything up. They just want to go to the data entry section, put in their data, and get out alive.

有些人喜欢被锁定的Excel工作簿,因此他们不会意外地弄乱任何东西。 他们只想转到数据输入部分,放入他们的数据,然后活着出去。

Other people hate Excel workbooks that are protected. Maybe they know a bit more about Excel, and are comfortable making changes.

其他人讨厌受保护的Excel工作簿。 也许他们对Excel有更多了解,并且乐于进行更改。

Or, they've been assigned to manage a workbook, and don't want to bother with worksheet protection, because it slows them down.

或者,他们已经被分配来管理工作簿,并且不想打扰工作表保护,因为这会使它们变慢。

赋予用户控制权 (Give the Users Control)

One of my clients has plants all over the world, and we've made a similar data collection workbook for each plant.

我的一位客户在世界各地拥有工厂,我们为每个工厂制作了类似的数据收集工作簿。

On the last sheet of the workbook, I've added a drop down list, where the user can select TRUE or FALSE.

在工作簿的最后一页上,我添加了一个下拉列表 ,用户可以在其中选择TRUE或FALSE。

LockFalse
  • If the setting changed to FALSE, a macro runs, to unprotect all the worksheets.

    如果设置更改为FALSE,则会运行一个宏,以取消保护所有工作表。
  • If the setting is changed to TRUE, all the sheets are protected.

    如果将设置更改为TRUE,则所有纸张都将受到保护。

The TRUE/FALSE option is a quick and easy way for users to control the workbook settings, and seems to be working well.

TRUE / FALSE选项是用户控制工作簿设置的快速简便的方法,并且似乎运行良好。

代码 (The Code)

There's code on the worksheet module that runs when the Lock cell's value is changed. To see the code, right-click on the sheet tab where the drop down list is located, and click View Code.

更改“锁定”单元格的值时,工作表模块上会运行代码 。 要查看代码,请右键单击下拉列表所在的工作表选项卡,然后单击查看代码。

Here's the bit of code that checks the Lock cell, and protects or unprotects the sheets. In the sample file, there is the full code, and another example that protects or unprotects with a password.

这是一些代码,用于检查Lock单元并保护或取消保护工作表。 在示例文件中,有完整的代码,还有另一个使用密码保护或取消保护的示例。

If Target.Address = wsListsAll.Range("Lock").Address Then For Each ws In ThisWorkbook.Worksheets If bLock = True Then ws.Protect Else ws.Unprotect End If Next ws End If

如果Target.Address = wsListsAll.Range(“ Lock”)。Address,则为此Workbook.Worksheets中的每个ws如果bLock = True,则ws.Protect其他ws.Unprotect结束,如果下一个ws结束,如果

下载样本文件 (Download the Sample File)

If you'd like to see all the code, you can download the sample file from the Worksheet Protection Selector page on my Contextures website.

如果您想查看所有代码,则可以从Contextures网站上的“工作表保护选择器”页面下载示例文件。

On that page, scroll down to the Download section, and you'll see a link to the file.

在该页面上,向下滚动到“下载”部分,您将看到该文件的链接。

The file contains macros, so you'll have to enable them to test the code. _______________________

该文件包含宏,因此您必须使它们能够测试代码。 _______________________

翻译自: https://contexturesblog.com/archives/2009/09/02/let-users-lock-or-unlock-an-excel-workbook/

excel表格锁定怎么解锁

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值