excel - Excel VBA:从一个工作表调用一个函数,该函数在不同工作表上搜索数据
问题描述
我有一个包含几张数据的工作簿。
在其他表上,我需要在其中一个数据表上进行搜索。
在我用来开始搜索的函数中,我有一个名为 firstcell 的参数,它告诉搜索函数从哪里开始。
发生的情况是搜索函数认为 firstcell 在调用函数所在的工作表上,而不是数据表上。
如何将正确的工作表传递给搜索功能?
Function GetValue(firstcell as string, searchterms) As Variant
''firstcell is the name of a named cell on the data sheet
''searchterms is a list of values that gets passed
. . . .
GetValue = MySearch(Range(firstcell), searchterms)
'' this is where firstcell becomes the address of the named cell but on the sheet where the function is
. . . .
End Function 'GetValue
谢谢
解决方案
推荐阅读
- php - symfony 4 中的动态表单内容变化
- mysql - TypeScript - mysql - socket.io 在尝试登录失败后重新发出
- c# - 清理串行读取字符串的第一部分
- python-2.7 - Python:如何编码优化问题的解决方案
- javascript - 使用 JavaScript 完全客户端将给定的文本文件字符串分配给变量
- java - org.openqa.selenium.WebDriverException:转发新会话时出错,找不到:Capabilities {acceptInsecureCerts:Firefox 为真
- css - 如何格式化文本中的文本用动画平滑滚动?
- python - Celery 每日计划任务与 Crontab
- python - 将有序字典列表写入python中1个单列的csv文件
- python - Tshark 在 Docker 内的 CentOS 上运行:不允许操作:'/usr/sbin/dumpcap'