akreidler
02-22-2013, 09:51 AM
Hello,
I have a VBA code that brings up an inputbox, searches for this RP# (which has to be in text form) and deletes the entire row that has the RP# in it
Sub Override()
Dim RPtoDel As String
Dim delrows As Long
RPtoDel = InputBox("Enter RP#")
Do While True
On Error GoTo Err_Handle
Worksheets("PY Query").Select
Range("P:P").Find(What:=RPtoDel, LookIn:=xlValues, LookAt:=xlWhole, After:=ActiveCell).EntireRow.Delete Shift:=xlUp
delrows = delrows + 1
Loop
Err_Handle:
MsgBox "Number of Deleted Rows - " & delrows
Worksheets("Ex Resident").Select
Range("B3").Select
End Sub
Unfortunately it is not finding the RP# in the list. I have double checked to make sure the RP#'s are in the list and they are. I am wondering if it has to do with the number having to be in text form (which it has to be since the query upload to the excel sheet has the RP# in text). Thanks for your help
I have a VBA code that brings up an inputbox, searches for this RP# (which has to be in text form) and deletes the entire row that has the RP# in it
Sub Override()
Dim RPtoDel As String
Dim delrows As Long
RPtoDel = InputBox("Enter RP#")
Do While True
On Error GoTo Err_Handle
Worksheets("PY Query").Select
Range("P:P").Find(What:=RPtoDel, LookIn:=xlValues, LookAt:=xlWhole, After:=ActiveCell).EntireRow.Delete Shift:=xlUp
delrows = delrows + 1
Loop
Err_Handle:
MsgBox "Number of Deleted Rows - " & delrows
Worksheets("Ex Resident").Select
Range("B3").Select
End Sub
Unfortunately it is not finding the RP# in the list. I have double checked to make sure the RP#'s are in the list and they are. I am wondering if it has to do with the number having to be in text form (which it has to be since the query upload to the excel sheet has the RP# in text). Thanks for your help