vba 在不保护工作表的情况下隐藏 Excel 中的公式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45435672/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-12 13:01:42  来源:igfitidea点击:

Hide formulas in excel without protecting the sheet

excelexcel-vbavba

提问by sethu

I need to hid the formulas in my sheet without protecting the sheet,say i have sheet 1 in that i need to hide the formulas from range(A1:G10) i can hide the formula but iam not able to provide input for the whole sheet

我需要在不保护工作表的情况下隐藏工作表中的公式,假设我有工作表 1,因为我需要从范围(A1:G10)中隐藏公式我可以隐藏公式但我无法为整个工作表提供输入

My requirement is to hide the selected cells formulas and able to give inputs for other cells in the same sheet how can i achieve this.

我的要求是隐藏选定的单元格公式并能够为同一工作表中的其他单元格提供输入,我该如何实现这一点。

采纳答案by Zac

Select the whole sheet, right click and then select Format Cells.... In the popup window, select Protectiontab. Unselect both options and press OKbutton. This will unlock all cells on the sheet as by default all cells are locked. Next, select your range, repeat the above process again but this time ensure that both options (Lockedand Hidden) are selected this time and press OK. Now protect your sheet (in Excel 2013, select the REVIEWtab and select Protect Sheetoption and follow the steps).

This will hide your formulas and stop anyone changing the values in the protected cells

选择整个工作表,右键单击,然后选择Format Cells...。在弹出窗口中,选择Protection选项卡。取消选择这两个选项并按下OK按钮。这将解锁工作表上的所有单元格,因为默认情况下所有单元格都被锁定。接下来,选择您的范围,再次重复上述过程,但这次确保这两个选项(LockedHidden)都被选中,然后按OK。现在保护您的工作表(在 Excel 2013 中,选择REVIEW选项卡并选择Protect Sheet选项并按照步骤操作)。

这将隐藏您的公式并阻止任何人更改受保护单元格中的值