【发布时间】:2018-10-17 01:27:02
【问题描述】:
我有一张 Excel 表格。我想在满足条件时重置循环,因为我有两个条件。但是,我想在这个解决方案网站Reset a for loop when a condition is met vba 的 for 循环旁边实施步骤。它不起作用,因为它仅适用于数字而不是 A1。解决此问题的解决方案是什么?谢谢。
Sub run()
Set MR = Range("A1:Q1")
'Loop through the cell in the first row
For Each cell In MR
If cell.Value = "First Discovered" Or cell.Value = "Last Observed" Then cell.EntireColumn.Delete
Next cell
End Sub
【问题讨论】:
-
我认为解决方案是仅在满足条件时重置循环。我应该扩展我的思维以寻找其他解决方案。感谢您提供出色的解决方案。