i am trying to insert a row on the first instance where the value in column y is above 60. Only one row.
i did a loop to insert multiple rows for anything above 60 but i dont need this.
having difficulty changing this
here's what i got
Dim Col As Variant
Dim BlankRows As Long
Dim LastRow As Long
Dim i As Long
Dim StartRow As Long
Col = "Y"
StartRow = 1
BlankRows = 1
LastRow = Cells(Rows.Count, Col).End(xlUp).Row
Application.ScreenUpdating = False
With ActiveSheet
For i = LastRow To StartRow + 1 Step -1
If .Cells(i, Col) > 60 Then
.Cells(i, Col).EntireRow.Insert shift:=xlDown
End If
Next i
End With
Application.ScreenUpdating = True
End Sub
Aucun commentaire:
Enregistrer un commentaire