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

                                                                                                            • Urgent: How to Bulk Upload Images in Zoho Inventory? Any Workarounds?

                                                                                                              We are currently onboarding 5,000+ items from Shopify into Zoho Inventory, but we’re struggling with the lack of a bulk image upload feature. Right now, we have to manually upload and assign images one by one, which is extremely time-consuming and inefficient.
                                                                                                            • Can I automatically update COGS and Inventory account when creating an item?

                                                                                                              I have been trying to get Zoho to update the other two fields when I update one (Sales Account, COGS account, and Inventory Account). I know this seems like not a huge time saver, but I am all about efficiency and being an independent taproom, I create
                                                                                                            • I'm looking for a Microsoft List alternative in Zoho One to manage large lists of repetitive tasks

                                                                                                              I've used Microsoft Lists to manage lots of tasks that need to be completed several times for different users. We started with a large spreadsheet and then discovered lists, which worked pretty well. I was wondering if there is a similar products in Zoho,
                                                                                                            • Zoholics Europe and UK Awards 2025: Honouring our loyal customers!

                                                                                                              We're excited to announce that at this year's Zoholics events across Europe, we're holding customer awards for the first time ever! This is your chance to shout about the amazing things you've created, connected, or achieved with Bigin! And if you win,
                                                                                                            • Fillable template with dynamic tables?

                                                                                                              Is there a way to build a fillable template so that users can add rows to a table? To describe what I'm trying to accomplish the table has 3 sections; a header row, some number of rows with custom information, and a summary row with totals. I can't figure
                                                                                                            • How to store API keys in zoho?

                                                                                                              Hi everyone, I'm currently building an integration using Zoho Flow and I need to securely store several API keys that will be used to make external service calls from my flows. I would not like to hardcode the values in the code of custom function. What's
                                                                                                            • Zoho RPA is now available in your Zoho One bundle!

                                                                                                              Hello All! Of late, it's been quite a stint of new app integrations in Zoho One. This announcement pertains to the addition of another Zoho application, the most sought-after Zoho RPA - Robotic Process Automation, to the bundle. What is Zoho RPA? Zoho
                                                                                                            • is there an easy way to embed a zoho analytics report into a widget (or inside the "account" page) of Zoho CRM

                                                                                                              Hi, I have built a report that is specific to an account in Zoho CRM but I would like this to be built into the Zoho CRM front-end. I have looked at the widget concept but it seems quite complicated (see attached screenshot but I need to filter this view
                                                                                                            • Bigin iOS app update - Introducing Card Scanner and initiating WhatsApp conversations using pre-approved templates.

                                                                                                              Hello everyone! In the latest iOS (v1.11.3) version of the Bigin app, we have introduced the following features: Card Scanner Initiating WhatsApp conversations. Card Scanner: Our new Card Scanner feature extracts contact information from business cards.
                                                                                                            • Introducing card scanner in Bigin Android app

                                                                                                              Hello everyone! We are excited to introduce the card scanner feature on the latest Android version(1.7.26) of the Bigin app as well. Card scanner extracts contact information from business cards and allows you to save them as contacts in Bigin. You can
                                                                                                            • Full RTL and Hebrew Translation Support for Zoho Creator User Portal (Including All System Pages, Templates, and MFA Screens)

                                                                                                              Dear Zoho Creator Team, We kindly request comprehensive support for right-to-left (RTL) languages, particularly Hebrew, across the entire Zoho Creator user portal. This includes system-generated pages, templates, and multi-factor authentication (MFA)
                                                                                                            • ZUG real estate virtual meetup 2025: Sign documents, collect payments, and automate workflows with Zoho Sign

                                                                                                              Hi there! Are you in real estate and looking for a secure, compliant way to manage all your paperwork? In such a fast-paced industry, timing, compliance, and client trust are everything. Handling paperwork has always been a challenge, whether you're finalizing
                                                                                                            • OCR (Optical Character Recognition), automatisation des PDF et autres améliorations de Zoho RPA

                                                                                                              Zoho RPA est une plateforme d'automatisation des processus robotiques conçue pour accélérer et simplifier vos workflows. Elle permet de connecter facilement vos applications cloud à vos systèmes existants, même ceux qui ne disposent pas d’API, afin d’automatiser
                                                                                                            • 📞 Call + 💬 WhatsApp + 📲 SMS in Zoho CRM – All in One Place!

                                                                                                              We’re excited to introduce HelloSend, a powerful communication extension for Zoho CRM that brings SMS, WhatsApp, and Voice Calling directly into your CRM workspace. Whether you're in sales, support, or service delivery, HelloSend helps you connect with
                                                                                                            • Automation#24: Auto-Update custom field from Accounts to Tickets

                                                                                                              Hello Everyone! Welcome back to the Community Learning Series! This episode dives into how Zylker Techfix streamlines account-related ticket references. Previously, employees had to manually check account details to retrieve specific customer information,
                                                                                                            • Product Updates in Zoho Workplace applications | May 2025

                                                                                                              Hello Workplace Community, Let’s take a look at the new features and enhancements that went live across all Workplace applications this May. Zoho Mail Increased Preset Limit for Reminder and Snooze Options Preset limits for the Reminder and Snooze options
                                                                                                            • Outlook 365 ('classic') won't connect to Zoho email

                                                                                                              New computer, fresh install of Office desktop. On the old computer Outlook was working fine with Zoho, retrieving/sending mail, etc. On the new one I can't connect the accounts in Outlook--Outlook just keeps popping up the box asking for a password. All
                                                                                                            • login email

                                                                                                              Never logged into email says last log in never loged into
                                                                                                            • Installment plans

                                                                                                              Hi I am looking for a way to allow my customer to make equal monthly payments. For instance if I create an invoice for customer Y for $1000 I want to allow them to make equal monthly payments for the next 6 months. I need those payments to be auto charged
                                                                                                            • Search Mail with URL parameters

                                                                                                              Is it possible to search Zoho Mail by passing URL params like we can in Gmail? eg. mail.google.com/mail/u/0/#search/from:(jane@doe.com)
                                                                                                            • Need Help Fetching Latest Conversion Rate by Date

                                                                                                              Hi Team, I’m currently working on building a Balance Sheet in Zoho Analytics across different entities, with a common base currency of USD. I receive USD conversion values on a daily basis, and my requirement is to always capture the most recent available
                                                                                                            • Enhance Zoho One Conditional Assignment to Fully Reassign App Settings When Changing Departments

                                                                                                              Hi Zoho Team, We’d like to submit a feature request regarding the current behavior of Zoho One’s conditional assignment logic when moving a user between departments. 🔧 Current Limitation As it stands, Zoho One’s conditional assignment does not remove
                                                                                                            • Category to Alert

                                                                                                              Hi I am looking for help on how to solve an issue. We use the Category field for all items. We also use Composite Items. We would like to create an email alert when a Sales Order is created, however it would need to look at the Item to identify the category
                                                                                                            • Validation Rule (Date)

                                                                                                              Hi There,  Can any anyone help me with the validation rule? I'm trying to fire a rule whereby the End Date cannot be before Start Date.  Any takers?  Manoj Nair
                                                                                                            • Beyond Email: #3 Organize effortlessly with Bookmarks

                                                                                                              With her team’s details now neatly saved under Contacts, Sarah is feeling more settled in Zoho Mail. As she begins exploring her new workspace, she remembers the collection of useful links she has saved on her browser—project trackers, client portals,
                                                                                                            • Notification based on created/updated sales order that contain certain line items.

                                                                                                              Hi, I am finding the workflows within Books somewhat difficult to setup, so I am thinking that a custom function may be the best way to go about this. I want to be able to send a notification to a team member that any sales order that has been created
                                                                                                            • Drawings in forms

                                                                                                              I do a lot of drawings during my consultations and I’d like to add  body maps or stencils that I can draw on in different colours and add explanations etc. I need to be able to erase mistakes etc. Ideally in a form that I can prepopulate with client details and a few questions/ client signature and then save as a form. is this currently possible? if not, is it in the pipeline? thanks, Dennis
                                                                                                            • How can I populate dropdown data with information from another source or app?

                                                                                                              I want to maintain a list of items in another app (say in excel or another database) and sync those as items in a drop down menu, instead of copy pasting to import. Is this kind of a feature available?
                                                                                                            • Workplace - Zoholics Europe Customer Awards

                                                                                                              Dear Zoho Mail Community! 📣 We're excited to announce that at this year's Zoholics events across Europe, we're holding customer awards for the first time ever! Workplace - Zoholics Europe Customer Awards This is your chance to shout about the amazing
                                                                                                            • Zoholics Europe Customer Awards

                                                                                                              Dear Zoho Workplace Community! 📣 We're excited to announce that at this year's Zoholics events across Europe, we're holding customer awards for the first time ever! Workplace - Zoholics Europe Customer Awards This is your chance to shout about the amazing
                                                                                                            • Change Default Currency in Zoho Reports

                                                                                                              Is it possible to default all currency fields in my Reports and Tables to my local currency without having to reformat them every time?
                                                                                                            • [Webinar] Deluge Learning Series - Master Conditional & Operational Logic in Zoho Deluge

                                                                                                              We’re excited to bring you the next session in our Deluge Learning Series—a focused one-hour webinar where you’ll level up your skills in conditional and operational logic using Deluge scripting. From writing clean if-else conditions to implementing powerful
                                                                                                            • UPI QR Code in Invoices

                                                                                                              Hi, It would be easier to make payment, if UPI Qr code is generated by Zoho Books and shown in the invoice itself.  This will promote digital payments and also makes it easier for customers to pay. It would be even helpful, if QR code contains the invoice
                                                                                                            • WebDAV support

                                                                                                              I need WebDAV support so that I can upload/download (and modify) documents from my local file system. Is anything planned in his direction?
                                                                                                            • Recurring Events Not Appearing in "My Events" and therefore not syncing with Google Apps

                                                                                                              We use the Google Sync functionality for our events, and it appears to have been working fine except: I've created a set of recurring events that I noticed were missing from my Google Apps calendar. Upon further research, it appears this is occurring
                                                                                                            • Zoho Inventory Item History

                                                                                                              Hi Zoho Inventory Team, I 've been testing the History feature on Inventory Items in a demo system and I noticed that when I changed the value of a field to a new value, the history just says "updated by - user1", it doesn't say what what field was changed
                                                                                                            • Filter Images in Work Drive

                                                                                                              Hi, what is the best way to be able to filter files by multiple descriptions, for example, the name of a person in the photo as well as, an item in the photo and other descriptions? With labels it looks like you can only select one label at once but this
                                                                                                            • Flow not working when trying to Create a Merged Doc with info from a custom CRM module w/ subform

                                                                                                              I am having a problem creating a flow that gets its info from a webhook connected to a button in a custom module in Zoho CRM. I have made a template in Writer that follows: This is a clone of  the template in the CRM mail merge which works perfectly if i do it manually through there. My flow gets the custom module entry id through a webhook, then fetches the module entry data, and creates a merge document from that data. I know the webhook and the fetch work because if i replace the "create merge
                                                                                                            • Smart Scheduling via Agent Confirmation

                                                                                                              We’re excited to introduce a smarter and more streamlined way to manage dispatched service appointments in Zoho FSM! Feature Highlights Field agents can now approve or reject service appointments assigned to them—helping reduce unnecessary workload and
                                                                                                            • How to delete Inactive users?

                                                                                                              We want to delete inactive users from our system, but went you deactivate still the names are shown at the inactive section. How to get really rid off these names? Thanks for your response! Fabian van den Barselaar
                                                                                                            • Next Page