Macro to find a item

Seanzies

Board Regular
Joined
Nov 19, 2005
Messages
212
I am in need of a Macro to find an item that will search the entire workbook.
But the item that they are searching for will be different everytime. I would like a dialog box to open with they click a button. I just need the macro. I can later assign it to the button.

I want it to work like the Edit - Find option but when you click the button a dialog box opens asking you to enter an item that you want to find.

Can anyone help? This is what i have so far but it doesn't bring up a window to enter in an item.
Code:
Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
        xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
        , SearchFormat:=False).Activate
End Sub
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
This adds a dialog box:

Code:
Dim FindText as String

FindText = Application.InputBox("Enter the text you wish to find: ", "Find Text", type:=2)

Cells.Find(FindText, LookIn:=xlValues)

cheers. ben.
 
Upvote 0
Why not just use the actual Edit | Find dialog box? You don't need code for that.

Tools | Customize.. | Commands (tab) | Edit (on left) | Find (on right). Click and drag it to whatever toolbar you want. Voila!
 
Upvote 0
This is all done natively .. searching the entire workbook is an option in the Find dialog box .. with 2003, you already have all this.
 
Upvote 0

Forum statistics

Threads
1,214,626
Messages
6,120,602
Members
448,974
Latest member
ChristineC

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