为什么我不能在匹配函数中使用相对单元格引用?如果我改为使用绝对单元格引用,这将按预期工作,但是我需要 excel 移动到下一行,每个单元格都在该范围内进行评估。例如,第一次迭代比较 B29,下一次迭代比较 B30,下一次迭代计算 B31,等等。请帮忙!
Sub Test()
For Each cell In Worksheets("Sheet1").Range("F29:F50")
If Not IsError(Application.Match(RC[-3], Range("Interior_Lining_Scuffs_Floors"), 0)) Then
cell.Value = "Interior Lining/Scuffs/Floors"
End If
Next
最佳答案
你可以使用这个:
For Each cell In Worksheets("Sheet1").Range("F29:F50")
If Not IsError(Application.Match(cell.Offset(,-3), Range("Interior_Lining_Scuffs_Floors"), 0)) Then
cell.Value = "Interior Lining/Scuffs/Floors"
End If
Next
关于vba - 匹配函数Excel VBA中的相对单元格引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22766586/