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

                                                                                                            • Mandate Assessments in Zoho Recruit's Candidate Application Form

                                                                                                              We're excited to announce the Include Assessment option for the Candidate Application Form, which lets you display the pre-screening assessment associated with the job opening along with the application form fields. This ensures that every candidate applying
                                                                                                            • Sending an email from contacts does not display the recipient's name correctly

                                                                                                              When I select a contact or group of contacts and then click the envelope to send mail, the contacts are added to the To section of a new email. Unfortunately, their First and last names are not displayed. The part of the email address before the @ sign
                                                                                                            • Writing SQL Queries - After Comma Auto Suggesting Column

                                                                                                              When writing SQL Queries, does anyone else get super annoyed that after you type a comma and try to return to a new line it is automatically suggest a new column, so hitting return just inputs this suggested column instead of going to a new line? Anyone
                                                                                                            • Stop adding Default ID column to xls exports

                                                                                                              When anything is exported to xls, Zoho adds a column with an ID. WE DO NOT WANT THIS COLUMN. We use an automated report to a team. We have our own tracking number. 1. This makes the report messy, it just pushes OUR data off to the right. 2. We have to
                                                                                                            • communication distribution

                                                                                                              Hello community! Request for help - how to resolve the issue of subscribing to specific content. I use ZOHO CRM and ZOHO CAMPAIGNS to send email communications to my customers. I only purchased ZOHO CAMPAIGNS after using the CRM for some time and I have
                                                                                                            • Truesync for Linux

                                                                                                              Is Truesync available on linux ?
                                                                                                            • Web access blocked

                                                                                                              Hello, My account (chris@thewebprojects.com) has been blocked due to security reasons. Please see attached. Can you kindly please help me. Thank you in advanced
                                                                                                            • How to determine ZohoCreator organization ID

                                                                                                              I am trying to setup an API to interface with my ZohoCreator app by following the self-client credential flow here https://www.zoho.com/accounts/protocol/oauth/self-client/client-credentials-flow.html However, it requires me to input my organization ID.
                                                                                                            • Autofill Zoho form with Zoho campaign data

                                                                                                              Hello, I send campaigns and we have set a button called "Demo" in that campaign. This button leads to a form. Since we have the data in Zoho Campaign, would it be possible that some fields of the form (first+last name, email, company) are automatically filled when our readers click on this button? If yes, how could I do that? Thanks Aurélie Leyendecker
                                                                                                            • Need to be Amount Adjusted with same Group Comany

                                                                                                              Dear Sir/ Madam, Good Day, Example wise i write my quire Below A B C & D E F Bothe are Same Group Companies We Paid 50000 AED to ABC Company but we received Invoice 48000 AED worth of material Balance 2000 AED invoice i received from D E F. I Need to
                                                                                                            • Transfer between 2 accounts in forein currency

                                                                                                              Hello, While abroad, I have exchanged some money in a money exchange service from a foreign currency (MYR) to another foreign currency (USD) without passing through my base currency (CHF). How do I record this transaction in Zoho Books? When I try to
                                                                                                            • Zoho Books Webhook in Custom Module doesn't work

                                                                                                              I have a custom module "Purchase Request" in Zoho Books in which we're trying to convert status of the PRs to Draft and Pending Approval. We've explored different applications and custom functions but found that the status is not "writable". However,
                                                                                                            • Issue with Missing Scope for Creating Service Report via Zoho FSM API

                                                                                                              Hello @Latha Velu , I am currently working on creating a connection to create a Service Report in Zoho FSM using the API. However, while configuring the required scopes, I noticed that the scope ZohoFSM.modules.ServiceReports.CREATE which
                                                                                                            • Imap Support?

                                                                                                              Does Zoho Books support IMAP? I have enabled outlook integration from settings in Zoho Books Yet the emails I send from Zoho Books for example if I email a purchase order or an invoice I dont see them in it in my sent box in outlook Is there a problem
                                                                                                            • ADDING FUEL SURCHARGE & HST

                                                                                                              Hello I need to invoice the customer showing both Fuel Surcharge & ON HST separately. The FSC should be 20% of the subtotal. The HST should be applied to sum of Subtotal + FSC So it should be like: SUBTOTAL: 100.00 FSC (20%): 20.00 HST (13%): $15.60 How
                                                                                                            • Zoho Project API search?

                                                                                                              Good day, i would like to search our entire portal for a task using the API. We have over 20k tasks so I dont to search for all tasks and then do a for each as it would take way to long and also would need to go over the limit of 200 records per query.
                                                                                                            • Handling Deposits to Vendors and how to book this

                                                                                                              Our scenario: 1. We rent equipment from a renting company for a project (Vendor "Eurorent") 2. We receive an order confirmation with a request to pay a deposit of € 1500. (this is not a Bill) 3. We pay a deposit of € 1500 for the equipment. 4. After using
                                                                                                            • Tip of the Week #61– 5 easy ways to declutter your inbox!

                                                                                                              Managing a shared inbox is easier than you think. With the right tools and a smart approach, your team can stay on top of every conversation, collaborate more effectively, and deliver timely responses without any unnecessary back-and-forth. Here are 5
                                                                                                            • Vertical Solution Zoho One

                                                                                                              Hello, is it possible to create a vertical solution for Zoho One? Just like it is possible for Zoho CRM?
                                                                                                            • Multiple workspaces with in Bigin CRM

                                                                                                              As a freelancer working as a sales representative for two companies, each with its own email address, I would like to know if it’s possible to have two separate workspaces in Bigin. This way, I could manage each company and its contacts independently,
                                                                                                            • Allowing subqueries in FROM clause

                                                                                                              When building a Query table in Zoho Reports, I encountered an error when attempting to put a subquery in the "FROM" clause of my statement.  Why isn't this currently supported?  Is there a plan to implement this functionality in the future?
                                                                                                            • CRM for Everyone - More Actions Option to Create Record

                                                                                                              Please consider the option create a new record for the module from the More Actions menu. I know there is an "Add New" icon further down the menu to create a record for any module, but this just seems more intuitive and could reduce the need for the "Add
                                                                                                            • Zoho books partners: Transferwise, Resolut

                                                                                                              Can anyone tell me if Transferwise and/or Resolut (payment systems) are in integrated?  I know PayPal and Google are, but in Europe we like Transferwise and Resolut is an up and coming multi-currency app. Xero and Transferwise are fully compatible. Thanks
                                                                                                            • Getting oauth errors on bigin

                                                                                                              Hi Support, I'm getting oauth errors on bigin even though it works fine with CRM. I created a self client which will add contacts. I gave every permission you could and it still didn't work. What should I do. I might just switch to the standard CRM since
                                                                                                            • Assessment Field in Custom View

                                                                                                              Zoho recruit finally added the ability to filter Job Applications by Assessment Answers This is a very valuable addition to the Recruit But this is currently missing from the custom view This should be added to the custom view as well
                                                                                                            • Name Change and Delete Email ID and Alias

                                                                                                              Hello please i require urgent assistance, 1.) I would also like to change the name that appears when people receive my emails. I have an info@spacetraiders.com but when people receive my email its say Ronma Adedeji instead of either Info or Space Traiders..
                                                                                                            • Feature Requests and enhancements: Subform

                                                                                                              By The Grace of G-D. Hi, It would make it much easier to use if we could have some more features in subforms: More Columns/Fields Set the size of a column Show the subform in Full Page Width Sorting By Column Please consider The above suggestions. T
                                                                                                            • Unapplied AP Credits not showing up on AP Detail Aging

                                                                                                              I am new to using Zoho Books. I was reconciling some accounts and found differences from the GL balance and AP Aging and it came down to unapplied vendor credits. Is there an option to include that on the report, so I can pull a matching AP Aging to the
                                                                                                            • Add Entry and Subform Record from Deluge Scripts

                                                                                                              Hi all,  I would like to know how do I add a new entry and also subform records from a deluge scripts.  I can use the insert into to add a new entry to a form, but how do i insert a collection into the subform of the entry? I am using a deluge script
                                                                                                            • Finding draft ticket replies

                                                                                                              Is there a way to see all tickets which have draft replies?
                                                                                                            • How to apply a tag to a ticket based on the to email address?

                                                                                                              I need to assign a tag to a ticket if the ticket was sent to a specific email address. For example, we have the email accounting[at]company.com forwarding into Zoho Desk. We would like all emails that were sent to this address to be tagged with an Accounting
                                                                                                            • Engineering Change Order Process using Tickets?

                                                                                                              Hi Zoho Community, I'm working with my company to create an Engineering Change Order/Request (ECO/ECR) process where engineers can internally create tickets for changes in a product that must be reviewed, approved and implemented by people or teams in
                                                                                                            • How can I move a ticket from Department A to Department B?

                                                                                                              Hi there, how do I move ticket from Department A to Department B? I went in the ticket and tried to scroll down the menu under the "department" but it won't let me, I am a support admin. Did I do anything wrong? or am I doing it in the wrong place?
                                                                                                            • Validation Rules Trigger on Untouched Fields

                                                                                                              In Zoho Desk, validation rules trigger for ALL fields during an update—even fields that weren't modified in the current edit. This behavior is fundamentally different from Zoho CRM and other Zoho products, where validation rules only apply to fields actually
                                                                                                            • How to work with getFieldNames formdata functions ,Any Examples

                                                                                                              I don't find any example showing usage of getFieldNames. Where do i find .is there any Help documents available
                                                                                                            • Zoho Notifications - Received two notifications for one message and none for the other

                                                                                                              We had a client reply to a ticket twice in one minute. The ticket owner received two emails for the second message but none for the first (which was crucial content and unfortunately was therefore missed). I'm assuming this created a race condition -
                                                                                                            • What is the difference between "Reply" and "Public Comment" in a ticket?

                                                                                                              Hey, my company is thinking about switching to Zoho Desk but we do not understand the difference between the "Reply" and the "Public Comment" feature. When should we use which? And why? What is the difference between them? Thank you for your help! Kindest
                                                                                                            • Tasks View for Opportunity/Jobs does not indicate "Related To" account

                                                                                                              How can ZoHo be setup so that when a task is created for an Opportunity, the subject automatically lists the underlying account? Right now, it's impossible to link the Account to the task when the task is created from the Job.  Therefore, the open task view is inadequate.  And it's a lot of maintenance to have to manually add the account to the subject...defeating the purpose of "Automated" workflow. 
                                                                                                            • can i show alert when i finish running the function?

                                                                                                              how i can show alert inside the custom function or popup notification. when i use alert inside the custom function it show this error Error at line number:  2 'ALERT' task can be used only in on load, on validate and on change actions ​
                                                                                                            • CRM calendar not syncing with Zoho Calendar

                                                                                                              The sync is not happening: This is my Zoho Calendar CalDAV synced with Outlook This is my Zoho CRM Calendar (sadly empty ...) I have enabled CalDAV Access. In Zoho Calendar, I have set up APP Calendar sync like this: What else can I check? Thank
                                                                                                            • Next Page