MJKeenan
04-16-2017, 10:59 PM
Need to delete rows where the criteria in Column D does not start with the number 7 in the Identifier. I have a macro to remove N/A's but I need this macro updated to remove sku's that start with the number 7.
Attached is the worksheet.
Sub RemoveNA_AmountsFromOrderForm()
Dim NAs As String
Set sku = [d7]
sku.Activate
Do Until sku.Text = ""
NAs = sku.Offset(1, 1) & sku.Offset(1, 2) & sku.Offset(1, 3) & _
sku.Offset(1, 4) & sku.Offset(1, 6) & sku.Offset(1, 7) & sku.Offset(1, 8)
'if the pricing row is all NAs then delete the pattern & pricing rows
If NAs = "N/AN/AN/AN/AN/AN/AN/A" Then
Set sku = ActiveCell.Offset(2, 0)
Range(sku.Offset(-2, 0), sku.Offset(-1, 0)).EntireRow.Delete
Else
Set sku = ActiveCell.Offset(2, 0)
sku.Activate
End If
Loop
End Sub
Attached is the worksheet.
Sub RemoveNA_AmountsFromOrderForm()
Dim NAs As String
Set sku = [d7]
sku.Activate
Do Until sku.Text = ""
NAs = sku.Offset(1, 1) & sku.Offset(1, 2) & sku.Offset(1, 3) & _
sku.Offset(1, 4) & sku.Offset(1, 6) & sku.Offset(1, 7) & sku.Offset(1, 8)
'if the pricing row is all NAs then delete the pattern & pricing rows
If NAs = "N/AN/AN/AN/AN/AN/AN/A" Then
Set sku = ActiveCell.Offset(2, 0)
Range(sku.Offset(-2, 0), sku.Offset(-1, 0)).EntireRow.Delete
Else
Set sku = ActiveCell.Offset(2, 0)
sku.Activate
End If
Loop
End Sub