其中这句
arg = "'" & path & "[" & file & "]" & sheet & "'!" & Range(ref).Range("A1").Address(, , xlR1C1)
为什么要用两个range呢,谢谢
Private Function GetValue(path, file, sheet, ref)
' 从关闭的工作薄返回值
Dim arg As String
'确定文件是否存在
If Right(path, 1) <> "" Then path = path & ""
If Dir(path & file) = "" Then
GetValue = "File Not Found"
Exit Function
End If
'创建公式
arg = "'" & path & "[" & file & "]" & sheet & "'!" & Range(ref).Range("A1").Address(, , xlR1C1)
'执行EXCEL4宏函数
GetValue = Application.ExecuteExcel4Macro(arg)
End Function
excel中vba编程range的应用
答案:1 悬赏:80
解决时间 2021-03-14 06:14
- 提问者网友:幽瑟玉琼情殇
- 2021-03-13 16:33
最佳答案
- 二级知识专家网友:绝望伪装
- 2021-03-13 17:07
假设ref代表的文本是:b2:c6
那么:range(ref)就表示b2到c6的范围;
range(ref).range("a1")就表示b2到c6这个范围的左上角第一个单元格,即b2单元格
这样做能确保定位到一个单元格上,而不是一个区域
那么:range(ref)就表示b2到c6的范围;
range(ref).range("a1")就表示b2到c6这个范围的左上角第一个单元格,即b2单元格
这样做能确保定位到一个单元格上,而不是一个区域
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯