I have looked for this everywhere but can't find an example of it. I have a code which searches a column and deletes all rows that contain the exact value within that cell.
I want to make this a code that could be used in any sheet with two input boxes the first asking the user which column to look in(this is what i am having an issue with)
and the second asking for the criteria.
The existing code is like this.
Sub OCR()
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
With ActiveSheet
.Select
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView
.DisplayPageBreaks = False
Firstrow = .UsedRange.Cells(1).Row
Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row
For Lrow = Lastrow To Firstrow Step -1
'Amend test
With .Cells(Lrow, "B")
If Not IsError(.Value) Then
If .Value = "Test" Then .EntireRow.Delete
End If
End With
'END of loop
Next Lrow
End With
So This will delete all rows where Test is in the relevant column (B), but how can I use an InputBox to decide the column and the value to look for.