gpt4 book ai didi

vba - 用于检查工作表是否存在的函数,在 If 语句中

转载 作者:行者123 更新时间:2023-12-04 21:10:03 25 4
gpt4 key购买 nike

我有一个检查工作表是否存在的功能。我无法让它在 if 语句中工作。

我宁愿不在保存结果的 if 语句之前创建变量。我应该将功能更改为子功能吗?

sub tester()
If ShExist("Equity") = True then call differentfunction
end sub

Function ShExist(name As String)
Dim WorksheetExists
WorksheetExists = Evaluate("ISREF('" & (name) & "'!A1)")
End Function

最佳答案

您的功能不完整或不正确。以下将起作用:

Function ShExist(name As String)
ShExist = Evaluate("ISREF('" & (name) & "'!A1)")
End Function

关于vba - 用于检查工作表是否存在的函数,在 If 语句中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44800042/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com