Search Box Macro Script To Search Using Filters In Sheet

Search Box Macro Script To Search Using Filters In Sheet

Hi there,

There are ways to create a search box in excel using a VBA. The main macro code is pasted below.

I was wondering if this could be doable with Zoho sheet. Would this code work? Or, do you guys have a solution to search the sheet and filter the results?

Thanks,
Chad

  1. Sub SearchBox()
    'PURPOSE: Filter Data on User-Determined Column & Text/Numerical value
    'SOURCE: www.TheSpreadsheetGuru.com

    Dim myButton As OptionButton
    Dim SearchString As String
    Dim ButtonName As String
    Dim sht As Worksheet
    Dim myField As Long
    Dim DataRange As Range
    Dim mySearch As Variant

    'Load Sheet into A Variable
      Set sht = ActiveSheet

    'Unfilter Data (if necessary)
      On Error Resume Next
        sht.ShowAllData
      On Error GoTo 0
      
    'Filtered Data Range (include column heading cells)
      Set DataRange = sht.Range("A4:E31") 'Cell Range
      'Set DataRange = sht.ListObjects("Table1").Range 'Table

    'Retrieve User's Search Input
      mySearch = sht.Shapes("UserSearch").TextFrame.Characters.Text 'Control Form
      'mySearch = sht.OLEObjects("UserSearch").Object.Text 'ActiveX Control
      'mySearch = sht.Range("A1").Value 'Cell Input
      
    'Determine if user is searching for number or text
      If IsNumeric(mySearch) = True Then
        SearchString = "=" & mySearch
      Else
        SearchString = "=*" & mySearch & "*"
      End If
        
    'Loop Through Option Buttons
      For Each myButton In sht.OptionButtons
        If myButton.Value = 1 Then
          ButtonName = myButton.Text
          Exit For
        End If
      Next myButton
      
    'Determine Filter Field
      On Error GoTo HeadingNotFound
        myField = Application.WorksheetFunction.Match(ButtonName, DataRange.Rows(1), 0)
      On Error GoTo 0
      
    'Filter Data
      DataRange.AutoFilter _
        Field:=myField, _
        Criteria1:=SearchString, _
        Operator:=xlAnd
      
    'Clear Search Field
      sht.Shapes("UserSearch").TextFrame.Characters.Text = "" 'Control Form
      'sht.OLEObjects("UserSearch").Object.Text = "" 'ActiveX Control
      'sht.Range("A1").Value = "" 'Cell Input
      
    Exit Sub

    'ERROR HANDLERS
    HeadingNotFound:
      MsgBox "The column heading [" & ButtonName & "] was not found in cells " & DataRange.Rows(1).Address & ". " & _
        vbNewLine & "Please check for possible typos.", vbCritical, "Header Name Not Found!"
      
    End Sub

    Access your files securely from anywhere







                            Zoho Developer Community





                                                  Use cases

                                                  Make the most of Zoho Desk with the use cases.

                                                   
                                                    

                                                  eBooks

                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho Desk.

                                                   
                                                    

                                                  Videos

                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho Desk.

                                                   
                                                    

                                                  Webinar

                                                  Sign up for our webinars and learn the Zoho Desk basics, from customization to automation and more

                                                   
                                                    
                                                  • Desk Community Learning Series


                                                  • Meetups


                                                  • Ask the Experts


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner




                                                            • Sticky Posts

                                                            • Introducing Forms in Zoho Sheet

                                                              We hereby bring you the power of ​forms in Zoho Sheet. ​Now, build and create your own customized forms using Zoho Sheet. Be it compiling a questionnaire or rolling out a survey, Zoho Sheet can do it all for you. Forms is an excellent feature that helps you collect information in the simplest of ways and having it in Zoho Sheet takes it a notch higher. Build Simple yet Powerful forms Building forms using Zoho Sheet is fairly simple. The exclusive 'Form' tab lets you create one quickly. Whether you
                                                            • Meet the latest feature of Zoho Sheet: Lock Cells

                                                              We are happy to announce the release of one of the most awaited features in Zoho Sheet. ​You can now lock the cells that you wish to keep ​secure. Once you are done with editing cells, you can lock them so that they won't be modified anymore. We believe that this feature will be a great addition to our existing set of collaboration features and is intended to improve your collaboration experience. You can access this new feature Lock from Data tab. Apart from being able to lock individual cell ranges,
                                                            • Feature enhancement: Highlight rows based on a cell value

                                                              Hello Sheet users, We're excited to announce a new feature enhacement, shaped directly by your valuable feedback! As you might know, conditional formatting is a great tool for anyone dealing with large data sets. Previously, if you’ve ever wanted to draw
                                                            • Revamped Print in Zoho Sheet—customized for paper

                                                              The latest enhancements to Zoho Sheet's Print settings allows you to print a worksheet or a selected range, with customizations that make the data comprehensible, even on paper.   Customize header and footer Make your spreadsheets meaningful with a relevant header and footer. You can now choose to display the file name, sheet name, current page number, total pages, date, and time as the header and footer in your print view. Besides the predefined elements, you can also give a custom text for header/footer.
                                                            • Slicers are now available in Zoho Sheet—filter your data interactively

                                                              At Zoho Sheet, we diligently track user requests and feedback. In line with this, based on extensive user requests, we've integrated Slicers to pivot tables and are delighted to announce its release. Slicers are interactive visual filters that have add,


                                                            Manage your brands on social media



                                                                  Zoho TeamInbox Resources



                                                                      Zoho CRM Plus Resources

                                                                        Zoho Books Resources


                                                                          Zoho Subscriptions Resources

                                                                            Zoho Projects Resources


                                                                              Zoho Sprints Resources


                                                                                Qntrl Resources


                                                                                  Zoho Creator Resources



                                                                                      Zoho CRM Resources

                                                                                      • CRM Community Learning Series

                                                                                        CRM Community Learning Series


                                                                                      • Kaizen

                                                                                        Kaizen

                                                                                      • Functions

                                                                                        Functions

                                                                                      • Meetups

                                                                                        Meetups

                                                                                      • Kbase

                                                                                        Kbase

                                                                                      • Resources

                                                                                        Resources

                                                                                      • Digest

                                                                                        Digest

                                                                                      • CRM Marketplace

                                                                                        CRM Marketplace

                                                                                      • MVP Corner

                                                                                        MVP Corner







                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now


                                                                                            Zoho Show Resources


                                                                                              Zoho Writer Writer

                                                                                              Get Started. Write Away!

                                                                                              Writer is a powerful online word processor, designed for collaborative work.

                                                                                                Zoho CRM コンテンツ








                                                                                                  Nederlandse Hulpbronnen


                                                                                                      ご検討中の方




                                                                                                            • Recent Topics

                                                                                                            • Email parser rule will only parse emails with an exact match? What madness is this?

                                                                                                              I finally got myhead around deluge and scripting, but wondered why my parser wasn't working. (https://help.zoho.com/portal/en/community/topic/extract-11-digit-number-in-any-position-from-enail-subject) Problem: There are *zero* characters or phrases that
                                                                                                            • How to add a fee based on payment method

                                                                                                              I currently accept both ACH payments and credit card. I want to add a 3% fee to a number of my subscription plans if the customer chooses to use a credit card (and not ACH/checking). How do I do this? Is there an in-built feature, or would i have to create
                                                                                                            • Condolences and Prayers Following the Ahmedabad Plane Crash

                                                                                                              Dear Zoho Team, We were heartbroken to learn about the tragic plane crash that occurred today in Ahmedabad, as reported in the news. On behalf of our entire team, we want to extend our deepest condolences to everyone at Zoho and across India who may have
                                                                                                            • CRM Analytics - Elegant Comparator

                                                                                                              Anyone noticed a wierd thing on the Elegant Comparator on CRM... Compare Among - Time Period - Last 6 Weeks... only 5 weeks show Compare Among - Time Period - Last 5 Weeks... only 4 weeks show Compare Among - Time Period - Last 4 Weeks... only 3 weeks
                                                                                                            • The Social Wall: May 2025

                                                                                                              Hey everyone, We're excited to share some powerful updates for the month of May! Let's take a look! Reply to your Instagram and Facebook comments privately through direct messages Are you tired of cluttered comment threads or exposing customer queries
                                                                                                            • Copy Templetes from one module to another in Zoho Books.

                                                                                                              Hello, I have created a Custom Module in Books for GST Invoice. I can see only 1 Invoice Templete over there. Can we clone or copy Invoices Templetes from Sales Module of Books into Customer Module.
                                                                                                            • Enhancements in Bookings browser extension

                                                                                                              Greetings from Zoho Bookings! We're here with another update to make your scheduling even quicker. We have enhanced our browser extension with three significant features: Copy slots to email Gmail integration LinkedIn integration Copy slots to email This
                                                                                                            • Some notes are shown as Not Synced

                                                                                                              I'm not sure why this happens but it's a weird little bug I noticed. I have two notes I believe that has that weird icon shown in the screenshot that shows that it's not synced even though the notes do sync properly. Manual syncing doesn't remove the
                                                                                                            • Power of Automation :: Auto-Color Tasks in Gantt chart based on values in Picklist field.

                                                                                                              Hello Everyone, A Custom function is a user-written set of code to achieve a specific requirement. Set the required conditions needed as when to trigger using the Workflow rules (be it Tasks / Project) and associate the custom function to it. Requirement:-
                                                                                                            • Zoho CRM record in blueprint unable to initiate any form of approval process

                                                                                                              My business case As a penetration testing company, we have engagements that need to follow a set path, from “to be scheduled” to “assigned to tester” to “regulatory documents sent” to “testing in progress” to “report delivered”. On this path, a particular
                                                                                                            • Edit Project Number?

                                                                                                              Hi all: We just signed up for a trial of zoho one, which includes ZoHo Projects. We've noticed there was a 'dummy project' preloaded in projects to help familiarize yourself with the software. We've created a couple of our own projects now but noticed since the dummy project was preloaded, our projects start with number 2 then 3, sequentially. Since it seems we will be keeping zoho past the trial, If we delete the dummy project, how do we get our own projects renumbered, beginning with 1? We'd like
                                                                                                            • Tip of the Week #57– Reply faster with saved response templates!

                                                                                                              Ever find yourself typing out the same email reply over and over again? It's time consuming and eats productive work hours. With shared response templates, you and your team can create pre-composed messages to quickly respond to common queries — saving
                                                                                                            • Connect MySQL database to Zoho sites

                                                                                                              Hi! Is there a way to connect a MySql database with Zoho sites. So the user input are stored in and dinamic data is fetched from the database? Regards, Mihály
                                                                                                            • What’s new in Zoho RPA: Cross-platform automation, OCR, and more!

                                                                                                              Zoho RPA is now included in Zoho One Zoho RPA is now part of the Zoho One suite, bringing unified automation to your entire business ecosystem. You can now automate UI-based tasks across Zoho apps and third-party systems too. From processing sales orders
                                                                                                            • New in CPQ: Create dynamic actions in Product Configurator (PC), clone PCs and Price Rules (PRs)

                                                                                                              Configuring product combinations just got enhanced. Zoho CRM's CPQ system now supports dynamic actions based on multiple base products. Additionally, you can now clone configurations for both Product Configurator (PC) and price rules (PRs). Dynamic actions
                                                                                                            • Beyond Email: #2 Connect better with Contacts

                                                                                                              After successfully creating a 'Welcome & Setup' event using the Calendar, Sarah is eager to invite her team members to participate. For a smoother communication experience and easy access, Sarah wants to store their information, ensuring quick reference
                                                                                                            • Integrate MS Teams with Zoho CRM for faster collaboration

                                                                                                              Availability Editions: Standard and above DCs: All Release status: This feature has been released for all users in all DCs. Help resource: Microsoft Teams integration Hello everyone, We're adding MS Teams to our lineup of CRM chat integrations—Cliq, Slack,
                                                                                                            • What is New in CRM Functions?

                                                                                                              What is New in CRM Functions? Hello everyone! We're delighted to share that Functions in Zoho CRM have had a few upgrades that would happen in phases. Phase 1 An all new built-in editor for better user experience and ease of use. ETA: In a couple of days.
                                                                                                            • Subforms and Reports

                                                                                                              I am trying to do a report that shows various data from subforms. eg I want a report that shows what Bill Status are Approved Required. Or show the status of all bills. It doesn't look like Zoho Reports picks up information within reports. Is there another
                                                                                                            • Pass variables to Zoho Desk via URL to create a fast new ticket landing page

                                                                                                              We are integrating our phone system into Zoho Desk. Currently when a helpdesk agent answers the phone, a soft client opens a new tab with zoho desk at the new case page. https://desk.zoho.com/support/companyname/ShowHomePage.do#Cases/new We would like
                                                                                                            • 【Zoho CRM】アナリティクス機能のアップデート:ウォーターフォールの導入

                                                                                                              ユーザーの皆さま、こんにちは。コミュニティチームの藤澤です。 今回は「Zoho CRM アップデート情報」の中からアナリティクス機能のアップデートをご紹介します。 本記事は、以前紹介された機能に新たに追加された機能です。 以前の記事:https://support.zoho.co.jp/portal/ja/kb/articles/zoho-crm-visualize-your-data-with-a-new-set-of-charts-treemap-butterfly-sankey-and-cluster-charts
                                                                                                            • [Free Webinar] Learning Table Series - Creator for the Finance Industry

                                                                                                              Hello Everyone! The Learning Table Series is a free monthly webinar that runs for around 45 minutes. It's offered to our Community users and aims to provide a dynamic learning experience by demonstrating how Creator can be used as a solution for various
                                                                                                            • Webhook - Configuration failed: 200 response not received for POST request

                                                                                                              Hello, I am trying to set up a webhook to connect with an automation software but I receive the following error from Zoho: Configuration failed: 200 response not received for POST request I have tried testing it on webhook.site as well and receive the
                                                                                                            • Automated Shopify adjustment problem. "An inventory adjustment has been created by the system to set the initial stock from Shopify"

                                                                                                              Has anyone noticed issues since the Shopify Sync has been updated recently? If you sync with Shopify, check to see if there are automated adjustments for old products that keep recurring. We have this problem for 6 SKU's that Zoho is doubling the stock
                                                                                                            • Best website platform to sync to Zoho Inventory

                                                                                                              Anyone like to suggest the best website platform for syncing to Zoho Inventory? We DO NOT want to sync stock, only orders. Shopify - not an option as we have more than one website and Shopify requires 2 accounts and Zoho will not sync with 2 different accounts. Magento and WooCommerce both sync via Kloudconnectors - does anyone have any experience with this? I have trialled it and there are flaws - eg purchase order numbers are not populated. Discussion welcome!
                                                                                                            • Include product images in data sync between Zoho CRM and Zoho Inventory

                                                                                                              Currently the item image does not sync between Zoho CRM and Zoho Inventory when using the internal Zoho sync functionality. This requires users to manually update the item image in Zoho Inventory for products created in CRM and vice versa. Including the
                                                                                                            • Show ordered quantity on packing slips and invoices

                                                                                                              Hello Is there any way possible to show the original ordered quantity of an item (as recorded in the sales order) on subsequent package slips and sales invoices, so that these documents can show the customer the ordered qty vs the qty being currently
                                                                                                            • Search Zoho Inventory Items module via API

                                                                                                              How can I search Zoho Inventory Items by custom fields, categories, etc using the API? This is not documented. Is there an advanced search function like CRM's COQL search available via the Zoho API? If there is an undocumented way to search Items via
                                                                                                            • How can I get my images to display correctly on mobile site?

                                                                                                              I have just created a site and uploaded images, which look perfect on the desktop version. However when I view the site on my mobile device some of the images are not displaying correctly. They are all blurry. Anyone else experience this?
                                                                                                            • Does Creator support HTMX?

                                                                                                              I love the Zoho ecosystem and Zoho Creator does a lot of things really well. However, I'm needing more real-time interactivity in my forms. Is the only option to create a JS widget? How about HTMX?
                                                                                                            • My fix for "This report is not accessible" in published pages

                                                                                                              Hi Community, after having the same issue as many others here and going through the community's posts, i found a solution on my own. Again, the quality of support from Zoho is pretty awful: if you cannot help yourself, you're lost. I really like Zoho,
                                                                                                            • Tip of the Week #59– Enhance team collaboration with multichannel shared inboxes!

                                                                                                              Struggling with scattered customer conversations and missed follow-ups across your team? When messages are everywhere, it's easy for them to fall through the cracks—leading to delays, duplicate replies, and miscommunication among team members. Zoho TeamInbox
                                                                                                            • Subforms in stateless forms

                                                                                                              I think the title says it all. We need to be able to add subforms to stateless forms. Currently the only workaround is to create a Form and delete each record upon submission of the form. I need to build an interface to update our inventory. Basically
                                                                                                            • Delete standard e-mailtemplate

                                                                                                              Hello, Is it possible to delete or hide a standard e-mailtemplate? I would only like to show my own created e-mailtemplates to my staff. I only find a 'delete' option at my custom made e-mailtemplates, but the standard e-mailtemplates do not show this
                                                                                                            • Add values to Countdown Mode

                                                                                                              Is it possible to add values to the countdown mode drop down? The longest is 2 days. I would like values for 5 days, 10 days, 15 days...
                                                                                                            • RSS feed from a Zoho site blog?

                                                                                                              Does the Zoho Site blog have an RSS feed associated with it? I would like to have this picked up on a business Facebook page. thanks
                                                                                                            • Refresh token not appearing

                                                                                                              Hello, I was wondering if there is another way of obtaining a refresh token, as following the usual 60-second-code procedure generates a new access token, but not the refresh token, and so i have to repeat everything to get a new token every hour or so,
                                                                                                            • How would I collect a signature in person on Zoho sign?

                                                                                                              Suppose I have a customer show up at my office and we close a deal. I have an iPad ready to go, and I need to have the customer sign the document right there. How would I do it?
                                                                                                            • What's New in Zoho Analytics - June 2025

                                                                                                              Hello Users, We're delighted to bring you new features and enhancements designed to make your analytics experience smarter and more powerful than ever. AutoML Enhancements We’re thrilled to introduce powerful new AutoML enhancements, making machine learning
                                                                                                            • CRM Client scripts via extension?

                                                                                                              I've made a lot of industry specific customization to zoho CRM, using custom modules, workflows/automations, deluge scripts, api calls, and client scripting. I have had organic interest explaining what i've done to other small business owners in my industry.
                                                                                                            • Next Page