excel - 尝试在具有更改行数的过滤数据的表上使用 Vlookup
问题描述
我已经创建了一个包含过滤数据表的表。在此之后,我想应用 VLookup 命令,使用日期并查找与该日期关联的工单。(这应该每个日期只返回一个工作订单)
这就是我到目前为止所拥有的。我认为我可能遇到的一些问题是在我更改表格的大小之后,因为这个范围随着每个过滤的应用而改变。
Dim DeliverableTablefltrdRng As Range
Set DeliverableTablefltrdRng = rRange.SpecialCells(xlCellTypeVisible)
Dim cel As Range
Dim DeliverableDate As Date
For Each cel In Range("K2:K" & Cells(Rows.Count, 1).End(xlUp).Row).SpecialCells(xlCellTypeVisible)
'Now we need to verify if the date from the for loop falls
'between our inputed start and end date
DeliverableDate = cel
If ((DeliverableDate >= Start_Date) And (DeliverableDate <= End_Date)) Then
'This "if" statement states that we have found a value between the deliverable dates
'Next let's record the work order associated for this project
'We can achieve this by using a vlookup command
workOrder = Application.VLookup(DeliverableDate, DeliverableTablefltrdRng, 6)
'DeliverableTablefltrdRngDeliverableTable = Sheet1.Range
Debug.Print cel
Debug.Print workOrder
Else
End If
Next cel
解决方案
推荐阅读
- excel - 格式数字能够正确搜索
- java - 在 jdbcTemplate.update(String sql,Object[] args,int[] argTypes) 和 jdbcTemplate.update(String sql,Object[] args) 之间进行选择
- c++ - 理解 C++ 函数指针在 HIP 中的引用传递
- django - 在Django模板中循环时获取相关项目
- python - 是否可以从保存的 CNN 中提取分配给训练图像的类别概率?
- snowflake-cloud-data-platform - 雪花是否支持正则表达式中的积极向后看?
- node.js - 使用axios获取外部镜像,然后保存到文件系统?
- android - 我的应用程序如何跟踪特定的手机下载量?
- apache-kafka - Kafka如何实现强一致性?
- azure - 天蓝色代理调用和相同的后端函数调用行为不同