0
试图查看列中的单元格,然后查明单元格是否具有6/7字符以及是否有i。VBA有条件的跳过语句循环
然后复制。
Sub ctest()
Dim i As Long
For i = 1 To 5000
With Range("AR" & i)
If Left(.Value, 1) <> "i" Then GoTo NextIteration Else
If Len(.Value) = 6 Then .Copy Destination:=.Offset(, 2)
If Len(.Value) = 7 Then .Copy Destination:=.Offset(, 2)
NextIteration:
End With
Next i
End Sub
但这似乎并没有工作以及.. 谢谢你们。
子CTEST() 昏暗我只要 对于i = 1到5000 随着范围( “AR” &i) If Left(.Value,1)<>“i”Then GoTo NextIteration Else If Len(.Value)= 6 Then .Copy Destination:=。Offset(,2) 如果Len(.Value )= 7然后。复制目标:=。偏移(,2) NextIteration: End With Next i End Sub – user3724482
Define“但这似乎不起作用。” - 它给出了一个错误?它不符合你的期望吗? – YowE3K