Help deleting rows with vba

  • Thread starter Thread starter twist
  • Start date Start date
T

twist

I'm looking for a way to complete this task:


If A1 equals C1 then delete A1 through F1, repeat on to the next ro
until row is empty.


If you can leave feedback, thankyou
 
cRows = Cells(Rows.Count,"A").End(xlUp).Row
For i = cRows To 1 Step -1
If Cells(i,"A").Value = Cells(i,"C").Value Then
Range("A" & i & ":F" & i).ClearContents
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
I did miss an End If but the xlUp is okay. Did you cut and paste or type it
in?

cRows = Cells(Rows.Count, "A").End(xlUp).Row
For i = cRows To 1 Step -1
If Cells(i, "A").Value = Cells(i, "C").Value Then
Range("A" & i & ":F" & i).ClearContents
End If
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


Bob Phillips said:
cRows = Cells(Rows.Count,"A").End(xlUp).Row
For i = cRows To 1 Step -1
If Cells(i,"A").Value = Cells(i,"C").Value Then
Range("A" & i & ":F" & i).ClearContents
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Back
Top