VBA & Macro Problems

How to Create an Excel Button to Open the Find Dialog via VBA

Kushani NimanthikaKushani Nimanthika Nov 11, 2026 869 views

Question details

The user wants to create a clickable worksheet button that opens Excel's built-in Find dialog using a VBA macro.

How to Create an Excel Button to Open the Find Dialog via VBA
Product
Excel
Device & OS
not provided
Scenario
Creating custom UI elements to access native Excel features when the standard ribbon is hidden or unavailable to end-users.
Observed behavior
Needs the correct VBA syntax and step-by-step method to link the native Find dialog trigger to a form control or shape.
Before you start

Ensure that the Developer tab is enabled in your ribbon settings so you can easily access the Visual Basic Editor and insert Form Controls.

Solution 1Recommended

Use VBA to Call the Built-in Find Dialog

Write a one-line VBA script to trigger Excel's native Find dialog and assign it to a custom shape or button.

This method gives users a direct interface to trigger the search function without relying on keyboard shortcuts or the top ribbon.

1
Open the Visual Basic Editor

Press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.

2
Insert a New Module

In the top menu, click Insert and select Module. This creates a new blank script window.

3
Paste the VBA Code

Type or paste the following code into the module window: Sub OpenFindDialog() Application.Dialogs(xlDialogFormulaFind).Show End Sub

4
Create a Button in the Worksheet

Close the VBA editor. Go to the Insert tab on your ribbon, choose Shapes, and draw a rectangle (or select Insert > Form Controls > Button from the Developer tab).

5
Assign the Macro to the Button

Right-click the shape or button you just created, click Assign Macro, select OpenFindDialog from the list, and click OK.

Use VBA to Call the Built-in Find Dialog
Save Requirement: You must save your file as an Excel Macro-Enabled Workbook (.xlsm) to ensure the macro button continues to function after you close and reopen the file.
Advanced Spreadsheet Macros

Create Macro Buttons Easily with WPS Spreadsheet

WPS Spreadsheet fully supports VBA macros, allowing you to create custom buttons, automate tasks, and call built-in dialogs seamlessly just like Microsoft Excel.

  1. 1. Open Developer Tools: Launch WPS Spreadsheet, open your file, and navigate to the Developer tab.
  2. 2. Write Your VBA Code: Click 'Visual Basic' or press Alt + F11 to open the editor, insert a module, and write your Find Dialog script.
  3. 3. Insert a Custom Button: Go to the Insert tab, select Shapes, and draw a shape on your spreadsheet to act as your button.
  4. 4. Assign the Macro: Right-click the shape, select Assign Macro, pick your script, and save the file in .xlsm format.
100% compatible with Microsoft Excel .xlsm and .xlsb macro formatsBuilt-in VBA environment for scripting and automationIntuitive interface to insert shapes and assign macros in secondsLightweight application with incredibly fast launch speeds
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't my macro button work after closing and reopening the file?

This usually happens if the file was saved as a standard Excel Workbook (.xlsx). Standard workbooks strip out macros for security reasons. You must save the file via 'Save As' and choose Excel Macro-Enabled Workbook (.xlsm).

Can I open the Replace dialog instead of the Find dialog?

Yes, you can easily modify the VBA code to open the Replace dialog instead. Change the code to use Application.Dialogs(xlDialogFormulaReplace).Show.

Why is the Developer tab missing from my Excel ribbon?

By default, Microsoft Excel hides the Developer tab. To enable it, go to File > Options > Customize Ribbon, and check the box next to 'Developer' in the right-hand pane.

Is it possible to use a keyboard shortcut instead of a button?

Yes. While Excel has a built-in shortcut for Find (Ctrl + F), you can assign a custom shortcut to your macro. Press Alt + F8 to open the Macro dialog, select your macro, click Options, and assign a shortcut key.