Row Deletion based on condition.

M

Manish

I want to delet a particular row based on a particular condition which has
multiple conditions.
Please asist ASAP as this will be a great help for me.
 
M

Mike H

Hi,

I think your going to have to provide a bit more detail:-

Could this be any row?
What are the conditions?

Mike
 
G

Gord Dibben

You will have to.............

1. Use VBA

2. Provide much more detail on particular condition or multiple
conditions.


Gord Dibben MS Excel MVP
 
M

Manish

Hi Gord,
I appreciate your reply,
i have a table as below

Student Name Pass/Fail Exam
Manish Fail VB
Gord Pass Java

the above table is an example of my job sheet it has thousands of records i
want to run a macro where i can Delete all the rows for the Students who
gave JAVA exam and failed by a single macro.
i know this can be achived my filtering but then again i have delete the
row after selecting. I want some thing as below.......

if(exam = "JAVA" and Pass/Fail="Fail", then delet the particular row)

I appreciate your help.
Waiting for your response.
Regards,
Manish
 
G

Gord Dibben

Assuming your data is in columns A through C

Option Compare Text
Sub delete_fails()
Dim rng As Range
Set rng = ActiveSheet.Range(Cells(2, 3), _
Cells(Rows.Count, 3).End(xlUp))
For Each cell In rng
If cell.Value = "Java" And _
cell.Offset(0, -1).Value = "Fail" Then
cell.EntireRow.Delete
End If
Next
End Sub


Gord
 

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