What it's for: I have a part list that changes per job.
What I am trying to accomplish: If selected cell is not in column A then msgbox prompts user to "select part #" Then only run delete macro if selected cell is in range A9:lastrow
Why only column A: If I can force them to select the cell in column A then I can use ActiveCell.Offset to add info to the msgbox asking them if they are sure that is what they want to delete and include other cells info about the part # they selected.
Above Row 8 is header so that has to be locked out.
Each of my part #'s has 3 rows that's why I run the "EntireRow.Delete" 3 times.
This is what I have now.
Sub DeleteRow()
If MsgBox("Are you sure you want to delete this part?" & vbNewLine & " " & vbNewLine & ActiveCell.Value & vbNewLine & ActiveCell.Offset(0, 1).Value & vbNewLine & "QTY: " & ActiveCell.Offset(0, 12).Value, vbYesNo) = vbNo Then Exit Sub
If ActiveCell.Row > 8 Then
Rows(ActiveCell.Row).EntireRow.Delete
Rows(ActiveCell.Row).EntireRow.Delete
Rows(ActiveCell.Row).EntireRow.Delete
End If
End Sub
ActiveCell
row was> 8
(and column was=1
)? Otherwise they are going to say "Yes" and then you are going to ignore them anyway. – YowE3K