+ Reply to Thread
Results 1 to 9 of 9

Adding a search box with VBA - School Reading Awards

  1. #1
    Registered User
    Join Date
    05-04-2020
    Location
    Bournemouth, England
    MS-Off Ver
    2016
    Posts
    7

    Adding a search box with VBA - School Reading Awards

    Hello All,

    I'm hoping for a little help with a spreadsheet I've built for my school to track Reading Achievements across all the Classes.

    The file works by taking info from a "Data" worksheet and populating a series of charts to show current status.
    It may be a little clunky but it works. All the names in this file version are random so no GDPR issues!

    When a new child joins the school I currently add their name and class to the bottom of the list in the "Data" tab and then click the 'Sort Names' button I've added and it sorts them into the correct class alpha/numerically. I managed to follow some examples from the Internet and by doing step-by-step managed to add VBA code to make it work even though I don't know VBA.

    What I would like to do now is also add a 'Search Names' text input box that will collapse all the rows apart from the matching criteria ... so as to make it easier to enter each achievement rather than having to scroll up and down the data all the time. I would like the search box to be dynamic so it displays rows as you type Smith e.g. S, Sm, Smi, Smit, Smith etc and finds any matching rows that contain the search letters within a name e.g. Smith, Psmith and Zesmithson would all be displayed.

    I've tried and tried and did manage to create the search box and a linked empty cell etc but had two problems!
    1. It stopped the Sort Names from working
    2. When the search box was cleared it only showed the rows that contained text in the names columns and hid all the blank rows thus stopping me from adding new pupils etc.

    I would be really greatful if someone could have a looking at my attached file and add a text search box into cell A2 but that when cleared reopens ALL rows.
    Or if there is a far more elegant way of being able to have both functions of Sort Names and Search side by side please feel free to enhance the file!
    The password if needed for any tab is Bethany123

    I want to keep 400 rows of data to allow for an everchanging list of pupils in the school - we are usually 32 per class and 12 classes, so if I account for 33 x 12 = 396 rounded equals 400 I should be safe.

    Your help is gratefully received as it seems to be a bit beyond me as hard pressed Teaching Assistant!
    Attached Files Attached Files
    Last edited by Feenix60; 04-10-2024 at 01:56 PM.

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: Adding a search box with VBA - School Reading Awards

    You forgot to attach your example workbook.

  3. #3
    Registered User
    Join Date
    05-04-2020
    Location
    Bournemouth, England
    MS-Off Ver
    2016
    Posts
    7

    Re: Adding a search box with VBA - School Reading Awards

    Quote Originally Posted by Logit View Post
    You forgot to attach your example workbook.
    D'oh! Schoolboy error! Now corrected, Thanks.

  4. #4
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,047

    Re: Adding a search box with VBA - School Reading Awards

    Does this work for you?
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-04-2020
    Location
    Bournemouth, England
    MS-Off Ver
    2016
    Posts
    7

    Re: Adding a search box with VBA - School Reading Awards

    Many thanks ByteMarks, exactly what I was looking for.
    I had an issue at first in that I was blocked from running Macros but Google helped me out!
    Many thanks again for your help

  6. #6
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,047

    Re: Adding a search box with VBA - School Reading Awards

    You're very welcome.

  7. #7
    Registered User
    Join Date
    05-04-2020
    Location
    Bournemouth, England
    MS-Off Ver
    2016
    Posts
    7

    Re: Adding a search box with VBA - School Reading Awards

    Hello - Hopefully ByteMarks sees this thread as they have done stirling work on my issue.

    I have a spreadsheet that I'm using in my school (data/names in the attached file is random so no GDPR issues) to record Reading Awards.

    My VBA knowledge would fit on a stamp so I posted my file asking if someone could add a Search Box on to the 'Data' worksheet of my file to allow users to filter names.

    Unfortunately the Search Box will work fine if the 'Data' worksheet is unprotected but returns a Run Time error message if I use it when the worksheet is protected.

    Is there a way to protect the worksheet (so errant TA's don't play with structure etc. The password is Bethany 123.

    If some kind soul could take pity on me and wave a magic wand over the VBA/file and get the Search Box working in a protected worksheet.

    Many thanks.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,047

    Re: Adding a search box with VBA - School Reading Awards

    Try unprotecting before and reprotecting after

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    05-04-2020
    Location
    Bournemouth, England
    MS-Off Ver
    2016
    Posts
    7

    Re: Adding a search box with VBA - School Reading Awards

    Many thanks ByteMark - that's done the trick

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Adding in column causing issues with reading from another tab.
    By JChandler8314 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-13-2022, 08:44 AM
  2. [SOLVED] V Look Up - reading duplicate codes and adding values together.
    By ExcelnoviceUK in forum Excel General
    Replies: 8
    Last Post: 02-15-2018, 05:02 AM
  3. [SOLVED] Sales brand awards
    By makinmomb in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-27-2015, 03:44 AM
  4. Formula which awards different value according to percentage range
    By robwein83 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-10-2011, 12:12 PM
  5. Excel 2007 : class awards
    By giant in forum Excel General
    Replies: 4
    Last Post: 10-11-2009, 05:42 PM
  6. 5 year service awards
    By PAR in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-22-2006, 11:15 AM
  7. Adding and Reading a ListBox Item
    By Geoff in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-28-2005, 08:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1