[英]VBA EXCEL for each cell in range
如果不满足条件,如何在不执行任何操作的情况下移动到下一个单元格
For Each Cel In Range("F22:F3000")
If IsEmpty(Cel.Value) = True Or Not IsDate(Cel.Value) Then
End If
Next Cel
If DateAdd("m", 2, Cel.Value) = Date Then
'Cel.Row(sRow).Select
ws_1.Rows(Cel.Row).EntireRow.Copy ws_2.Range("A" & Rows.Count).End(xlUp).Offset(1)
notify.Toast "My Title", "Message"
MsgBox "regarder la colonne Annotation", vbExclamation
End If
Next
next 没有 for 的编译错误
由于您似乎是初学者,让我向您展示您的代码在更正和缩进后的样子:
For Each Cel In Range("F22:F3000")
If IsEmpty(Cel.Value) = True Or Not IsDate(Cel.Value) Then
End If
If DateAdd("m", 2, Cel.Value) = Date Then
'Cel.Row(sRow).Select
ws_1.Rows(Cel.Row).EntireRow.Copy ws_2.Range("A" & Rows.Count).End(xlUp).Offset(1) notify.Toast "My Title", "Message"
MsgBox "regarder la colonne Annotation", vbExclamation
End If
Next Cel
如您所见,我删除了第一个Next Cel
,您在For
循环中只能有一个Next
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.