我想遍历我的范围并合并如果 B2:B100 为“否”则跳过的逻辑。
原始代码:
Dim cell As Range
For Each cell In Range("A2:A100")
FilePaths.Add cell.Value
Next cell
试:
If cell.Range("B2:B100") <> "Yes" Then
不知道下一步要去哪里。我想去 col A 的下一个单元格,或者继续回到 col A。
最佳答案
使用 Offset
指向 Range
在给定的行和/或列与引用的偏移量
Dim cell As Range
For Each cell In Range("A2:A100")
If cell.Offset(0, 1).Value2 <> "NO" Then FilePaths.Add cell.Value2
Next cell
关于VBA,如果跳过单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51861536/