vba 其他工作表中的工作表功能
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25108406/
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
Worksheetfunction in other sheet
提问by Tarik
I have copied and paste a code and it does not work properly. I have not changed anything and I am figuring out why it will not work. After a while i think I found the bug. I don't know how to fix it. This is the code
我复制并粘贴了一个代码,但它无法正常工作。我没有改变任何东西,我正在弄清楚为什么它不起作用。过了一会儿,我想我发现了这个错误。我不知道如何修复它。这是代码
GroupPresence = WorksheetFunction.CountIf(Range("B1:D19"), salk)
it has to be something like this:
它必须是这样的:
GroupPresence = WorksheetFunction.Worksheet("Sheet9").CountIf(Range("B1:D19"), salk)
The code is wrong? Does someone know what the correct code is in refering to another sheet.
代码错了?有人知道引用另一张纸的正确代码是什么吗?
回答by chris neilsen
Wrong syntax. Use
错误的语法。用
WorksheetFunction.CountIf(Worksheets("Sheet9").Range("B1:D19"), Salk)