Find next and do NOTHING

Yamezz

Active Member
Joined
Nov 22, 2006
Messages
329
Office Version
  1. 2019
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:
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.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,214,584
Messages
6,120,385
Members
448,956
Latest member
JPav

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top