你到底是要插入行还是插入列?
判定的位置插入列:
Sub abc2()
For i = 1 To 10
t = Cells(i, 1).Value
If t = 5 Then
'插入列在前
Cells(i, 1).EntireColumn.Insert
'插入列在后
' Cells(i, 2).EntireColumn.Insert
End If
Next
End Sub
Sub abc2()
For i = 1 To 100
t = Cells(i, 1).Value
If t = 5 Then
Rows(i + 1).Insert
End If
Next
End Sub
Sub abc2()
For i = 1 To 100
t = Cells(i, 1).Value
If t = 5 Then
Selection.EntireRow.Insert
End If
Next
End Sub