2nd Input for Row Deletion Requirements not Applying Properly

Neild137

New Member
Joined
Mar 23, 2017
Messages
48
I had a code to prompt for two different inputs to search another sheet and the delete the entire row if two conditions where met (entry ID $ and date). I adjusted this to re-select the data worksheet, because it was originally also deleting the actual row of the worksheet that this button was located in.
I think the Date Input is no longer applying properly now. Anybody have any ideas?
Code:
<code>Sub DeleteRowNow()

On Error Resume Next

Dim userinput As String, DateInput As String
userinput = InputBox("Enter a value to search for.", "Column A Search")
DateInput = InputBox("Enter a date to search for.", "Column AN Search")
Dim findrange As Range
Dim firstaddress As String
Set findrange = ThisWorkbook.Sheets("Location File Data").Columns("A").Find(what:=userinput, lookat:=xlWhole, LookIn:=xlValues)
If findrange Is Nothing Then
MsgBox "No matching search results"
Exit Sub
Else
Sheets("Location File Data").Select
findrange.EntireRow.Select
Selection.EntireRow.Delete
Sheets("Compare").Select
End If

End Sub</code>
 
I added in one row to selection the Location File Data sheet after the data input boxes.
This works like a charm now!
Thank you much.
 
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Works great. I added in one row to select the Location File Data sheet after the input boxes. Thank you much.
 
Upvote 0
Scott,
Works like a charm! I just had to specify to select the appropriate worksheet before deletion.
Thank you!
 
Upvote 0

Forum statistics

Threads
1,215,261
Messages
6,123,946
Members
449,134
Latest member
NickWBA

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