crazybuckeyeguy
New Member
- Joined
- Apr 15, 2017
- Messages
- 49
I have an excel sheet with multiple rows similar to rows like you see below. the name field is column A and on row 2 the column a is blank. I escentialy need my vba to delete both lines is the second row has MEDL- UNPAID. unfortunalty our stupid progam sometimes puts the MEDL- UNPAID in row 1 and the Multi_skill in row 2. what am I doing wrong?
[TABLE="width: 597"]
<tbody>[TR]
[TD="colspan: 2"]KUBALEK, JAMILA[/TD]
[TD="colspan: 2"]Multi_Skill[/TD]
[TD] 6:00 AM[/TD]
[TD] [/TD]
[TD] 2:30 PM[/TD]
[TD]Multi_Skill[/TD]
[TD] [/TD]
[TD] 6:00 AM[/TD]
[TD] [/TD]
[TD] 2:30 PM[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD="colspan: 2"]MEDL- UNPAID[/TD]
[TD] 6:00 AM[/TD]
[TD] [/TD]
[TD] 2:30 PM[/TD]
[/TR]
</tbody><colgroup><col><col><col><col><col><col span="2"><col><col><col><col><col></colgroup>[/TABLE]
Sub fixBlanknametest()
Sheets("Data").Activate
lr = Cells(Rows.Count, 1).End(xlUp).Row
For i = lr To 12 Step -1
If Cells(i & 8).Value = "Multi_skill" And Cells(i & 1 + 1).Value = "" And Cells(i & 8 + 1).Value = "MEDL- UNPAID" _
Then
Rows(i).Delete
End If
Next i
End Sub
[TABLE="width: 597"]
<tbody>[TR]
[TD="colspan: 2"]KUBALEK, JAMILA[/TD]
[TD="colspan: 2"]Multi_Skill[/TD]
[TD] 6:00 AM[/TD]
[TD] [/TD]
[TD] 2:30 PM[/TD]
[TD]Multi_Skill[/TD]
[TD] [/TD]
[TD] 6:00 AM[/TD]
[TD] [/TD]
[TD] 2:30 PM[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD="colspan: 2"]MEDL- UNPAID[/TD]
[TD] 6:00 AM[/TD]
[TD] [/TD]
[TD] 2:30 PM[/TD]
[/TR]
</tbody><colgroup><col><col><col><col><col><col span="2"><col><col><col><col><col></colgroup>[/TABLE]
Sub fixBlanknametest()
Sheets("Data").Activate
lr = Cells(Rows.Count, 1).End(xlUp).Row
For i = lr To 12 Step -1
If Cells(i & 8).Value = "Multi_skill" And Cells(i & 1 + 1).Value = "" And Cells(i & 8 + 1).Value = "MEDL- UNPAID" _
Then
Rows(i).Delete
End If
Next i
End Sub