Good Morning,
In my excel sheet I have 2 columns of data, (previously exported from ms project earlier on in the macro) that I want to filter data out of.
At the moment, I have tried to create a loop which searches column B starting at "B4" until it has either; found the term "Engineering" or comes to the end of the list without finding it, at which point the loop stops.
If the term "Engineering" is found, the data in the cell 1 to the right is copied into cell "C20".
Here is the code i put together below:
At the moment the code just keeps looping or gets stuck on the term engineering if it is found.![]()
Sub Filter() Range("B4").Select Do Until Selection.Value = "" If Selection.Value = "Engineering" Then Range("C20").Value = Selection.Offset(0, 1).Value Else Selection.Offset(1, 0).Select End If Loop End Sub
Can anyone improve upon this code or post/suggest an alternative to using such a loop? If done differently, the range to be checked/looped between is ("B4:B14").
Any help greatly appreciated.
Kind regards
Bookmarks