View Full Version : Delete Rows based on Input Box Enrty

07-24-2018, 01:44 PM
Hello All. I'm new to this forum and have a limited knowledge of writing VBA but I'm looking to change that.

In the attached sheet I would like to delete any rows where the results from the input box are not equal to the value in column "O".

I tried to use the following code but I'm getting the Error: Invalid or Unqualified Reference.

Sub BatchID()

'Declare Variable
Dim BatchID As String
'Get String from Input Box
InputBox ("Enter the batch id you need ")
'Delete any row where BatchId is <> value in Column ("O1 to end)
If BatchID <> Range("O:O") Then .Delete.EntireRow

End Sub

Any help on this would be greatly appreciated.


07-25-2018, 12:46 AM
Ok, first count the rows you have and then setup a loop to seacrh into the kolom for that value try this first. So you Will learn Vba. Show us the results