简体   繁体   English

Excel VBA隐藏工作表

[英]Excel vba Hide worksheets

I have serveral worksheets with macro's, some worksheets use other worksheets in the macro. 我有带有宏的服务器工作表,一些工作表在宏中使用其他工作表。 I only want to have 1 worksheet visible and the rest must behidden. 我只希望有1个工作表可见,其余的必须隐藏。 If i hide the worksheets the macro's do not run. 如果我隐藏工作表,则宏不会运行。

What is my mistake? 我怎么了

If the worksheet is hidden and the macro doesn't unhide the sheet first then it won't work. 如果工作表是隐藏的,并且宏没有先取消隐藏工作表,则它将无法正常工作。 You could add some simple code to cope with it such as: 您可以添加一些简单的代码来应对,例如:

If sheets("sheet1").visible = false
Then sheets("sheet1").visible = true

This will test to see if it is visible and then unhide it if not. 这将测试看是否可见,然后取消隐藏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM