crazybuckeyeguy
New Member
- Joined
- Apr 15, 2017
- Messages
- 49
OK so here is the VBA I am using. its supposed to delete the row with the work Multi_Skill if the row below it has a blank cell in column A and a specific text in column H. the dang thing isn't working. What have I done wrong?
Sub fixBlankname()
Sheets("Data").Activate
For My_ROWS = 1 To Range("A" & Rows.Count).End(xlUp).Row
If Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "FMLA" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "FMLVAC" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "GRPVAC" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "FS" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "PO" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "vaca" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "FMLAPO" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "vaca" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "MEDL- UNPAID" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "MEDL- PAID" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "SK" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "DF" Then
Rows(My_ROWS).Delete
End If
If Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "FMLA" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "FMLVAC" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "GRPVAC" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "PO" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "SK" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "DF" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "FS" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "vaca" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "FMLAPO" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "vaca" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "MEDL- UNPAID" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "MEDL- PAID" Then
Rows(My_ROWS).Delete
End If
If Range("H" & My_ROWS).Value = "VACA" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "FMLA" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "FMLAPO" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "FMLA-MEDR" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "FMLAPO" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "FS" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "FSCU" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "GRPVAC" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "HOLVAC" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "PO" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "FMLVAC" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "MEDL- UNPAID" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "INOFCE" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "MEDL- PAID" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "SK" And Range("A" & My_ROWS + 1).Value = "" Then
Rows(My_ROWS + 1).Delete
End If
Next My_ROWS
End Sub
Sub fixBlankname()
Sheets("Data").Activate
For My_ROWS = 1 To Range("A" & Rows.Count).End(xlUp).Row
If Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "FMLA" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "FMLVAC" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "GRPVAC" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "FS" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "PO" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "vaca" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "FMLAPO" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "vaca" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "MEDL- UNPAID" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "MEDL- PAID" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "SK" _
Or Range("H" & My_ROWS).Value = "Multi_skill" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "DF" Then
Rows(My_ROWS).Delete
End If
If Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "FMLA" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "FMLVAC" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "GRPVAC" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "PO" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "SK" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "DF" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "FS" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "vaca" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "FMLAPO" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "vaca" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "MEDL- UNPAID" _
Or Range("H" & My_ROWS).Value = "SEALEA" And Range("A" & My_ROWS + 1).Value = "" And Range("H" & My_ROWS + 1).Value = "MEDL- PAID" Then
Rows(My_ROWS).Delete
End If
If Range("H" & My_ROWS).Value = "VACA" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "FMLA" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "FMLAPO" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "FMLA-MEDR" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "FMLAPO" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "FS" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "FSCU" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "GRPVAC" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "HOLVAC" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "PO" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "FMLVAC" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "MEDL- UNPAID" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "INOFCE" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "MEDL- PAID" And Range("A" & My_ROWS + 1).Value = "" _
Or Range("H" & My_ROWS).Value = "SK" And Range("A" & My_ROWS + 1).Value = "" Then
Rows(My_ROWS + 1).Delete
End If
Next My_ROWS
End Sub