1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Excel VBA : Hide rows based on cell input.

Discussion in 'Business Applications' started by CNeedham, Jul 26, 2011.

Thread Status:
Not open for further replies.
  1. CNeedham

    CNeedham Thread Starter

    Joined:
    Jul 26, 2011
    Messages:
    7
    Hi all, long time reader, first time poster. I searched around and have found similar queries to what I require however I haven't been able to adapt these solutions with any success so here we go....

    I have a list of businesses in a spreadsheet with information such as name, phone number, e-mail, website, postcode etc. I would like a search box on the side, say in cell O2 where a user can input part or all of a postcode e.g. (LS19 or LS) and those that do not begin with LS would be hidden. The postcodes are in column G.

    I'm trying to make this as simple and user-friendly as possible so employees can find businesses in a certain area with ease. Thanks in advance for any help and please feel free to ask questions.

    Chris Needham
     
  2. CNeedham

    CNeedham Thread Starter

    Joined:
    Jul 26, 2011
    Messages:
    7
    Seems nobody had the answer so I found a work around myself. Just in case anybody else wants to do a similar thing. Using auto filter is the easiest way.

    Code:
    [SIZE="3"]Sub Search()
        Columns("G:G").Select
        Selection.AutoFilter
        ActiveSheet.Range("$G$1:$G$999").AutoFilter Field:=1, Criteria1:="*" & Range("O2").text & "*", _
            Operator:=xlAnd
    End Sub[/SIZE]
    
    Where G is the column to search for and O2 is the users input data.

    Guess this can be closed now, thankyou all for your help.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1009216

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice