vba的for和if结合应用,为什么跳出循环

2025-03-24 17:38:16
推荐回答(1个)
回答1:

Sub A()
For i = Cells(1, Columns.Count).End(1).Column To 1 Step -1
If Cells(1, i) = "" Or Cells(1, i) = 0 Then
Cells(1, i).Select
Selection.Insert Shift:=xlToRight
End If
Next
End Sub
试下这个