从另一个vlookup中减去一个vlookup,并将结果分配到范围VBA

发布于 2025-02-04 18:27:34 字数 444 浏览 1 评论 0原文

我正在尝试从另一个vlookup中减去一个vlookup,并将结果分配给我贬低的范围。我得到类型的不匹配。

dim wb as workbook
dim ws1_name as range
dim ws2_range as range
dim range as range

set wb = xxxxxxx
set ws1_name as .....
(all the ranges are set)
    
Dim x As Long
    
For x = 3 To lastr_ws1
range.Value = (Application.WorksheetFunction.VLookup(ws1_name, ws2_range, 27, False) - Application.WorksheetFunction.VLookup(ws1_name, ws2_range, 30, False))

Next

I'm trying to subtract one vlookup from another and assign the results to the range that I've decalred. I'm getting a type mismatch.

dim wb as workbook
dim ws1_name as range
dim ws2_range as range
dim range as range

set wb = xxxxxxx
set ws1_name as .....
(all the ranges are set)
    
Dim x As Long
    
For x = 3 To lastr_ws1
range.Value = (Application.WorksheetFunction.VLookup(ws1_name, ws2_range, 27, False) - Application.WorksheetFunction.VLookup(ws1_name, ws2_range, 30, False))

Next

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文