Hello, I'm trying to create a macro that will search in a specific column for any number equal or above 5.
The trick here is that I want the macro to have each match selecting the whole row and make it stop. After I see the selected row, I would like to run the macro again and it will go for the next match and so on.
Mumps helped me with another macro that was doing similar, but in that case I was looking for specific keywords in a column. Here is the thread:
The macro that I did now loops through a specific column, but it doesnt stop at each match, so I think I cannot use a loop in this case. Tried a few end loop commands, but no lucky. Here is how the macro was looking like:
I had rngSearch as a helper cell to store the previous search. C2 always starts as "2".
I'm uploading an example of the structure of the file.
The trick here is that I want the macro to have each match selecting the whole row and make it stop. After I see the selected row, I would like to run the macro again and it will go for the next match and so on.
Mumps helped me with another macro that was doing similar, but in that case I was looking for specific keywords in a column. Here is the thread:
Search function/button that will look for specific keywords in a designated column
Greetings everyone, I'm really strugling with a macro that will search in a specific column for a specified keyword, select the cell and let me see where it is located, then after I run the macro another time or press a button it will run again moving to the next matching keyword. I tried...
www.mrexcel.com
The macro that I did now loops through a specific column, but it doesnt stop at each match, so I think I cannot use a loop in this case. Tried a few end loop commands, but no lucky. Here is how the macro was looking like:
VBA Code:
Sub Depthcheck()
Dim rngSearch As Range
Dim LastRow As Long
Dim i As Integer
Application.ScreenUpdating = False
LastRow = Cells.Find("*", SearchOrder:=xlByRows, searchdirection:=xlPrevious).Row
Set rngSearch = Range("B" & Range("C2"))
For i = 4 To Range("B" & LastRow).End(xlUp).Row
If Cells(i, "B").Value >= 5 Then
Cells(i, "B").Activate
Application.Goto ActiveCell.EntireRow, True
Range("C2") = rngSearch.Row + 1
Exit For
End If
Next
Application.ScreenUpdating = True
End Sub
I had rngSearch as a helper cell to store the previous search. C2 always starts as "2".
I'm uploading an example of the structure of the file.