如何保护Excel中的单元格,但允许这些修改VBA脚本 [英] How to protect cells in Excel but allow these to be modified by VBA script

查看:603
本文介绍了如何保护Excel中的单元格,但允许这些修改VBA脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Excel,允许某些字段进行用户输入,其他单元格将被保护。我已经使用工具保护工具,但是在执行此操作后,我无法更改VBA脚本中的值。我需要限制表单停止用户输入,同时允许VBA代码根据某些计算来更改单元格值。

I am using Excel where certain fields are allowed for user input and other cells are to be protected. I have used Tools Protect sheet, however after doing this I am not able to change the values in the VBA script. I need to restrict the sheet to stop user input, at the same time allow the VBA code to change the cell values based on certain computations.

推荐答案

尝试使用

Worksheet.Protect "Password", UserInterfaceOnly := True

如果UserInterfaceOnly参数设置为true,则VBA代码可以修改受保护的单元格。

If the UserInterfaceOnly parameter is set to true, VBA code can modify protected cells.

这篇关于如何保护Excel中的单元格,但允许这些修改VBA脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆