Stumped and looking for solution tonight,

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
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Its doing nothing. Its supposed to the delete the row with the the Multi_skill in H and then the code later cleans up the row that was below it.

Can't see why it's doing nothing, unless none of your data meets the criteria per the code.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top