Help deleting rows with vba

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
 
B

Bob Phillips

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)
 
B

Bob Phillips

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top