I'm trying to work out a way to find a cell value in a worksheet of data, so I can glance at the data adjacent to the found cell value. I don't want to manipulate the data in any way, just look at it. I have the code to find the first instance, but then I want to be able to find any subsequent appearances of the cell value. I've looked for help on the FindNext command, but it is all a bit complicated for me.
So far I have this:
How do I then move on to the next instance of FindInvoiceName?
I currently have this macro assigned to a button on the worksheet. I guess the simplest thing would be to just hit the button again to initiate a further search for FindInvoiceName, moving down column B from the last occurrence of FindInvoiceValue. Then when there's no more instances of FindInvoiceValue I'll need a msgbox to tell the user that there's no more matches.
So far I have this:
Code:
Sub FindByName()
Sheets("Invoice Records").Select
Range("G1").Select 'The value to use as the search criteria is entered in G1
FindInvoiceName = ActiveCell.Value 'set the value of FindInvoiceName as value of currently selected cell
Columns("B:B").Select
Selection.Find(What:=FindInvoiceName, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Select
End Sub
How do I then move on to the next instance of FindInvoiceName?
I currently have this macro assigned to a button on the worksheet. I guess the simplest thing would be to just hit the button again to initiate a further search for FindInvoiceName, moving down column B from the last occurrence of FindInvoiceValue. Then when there's no more instances of FindInvoiceValue I'll need a msgbox to tell the user that there's no more matches.