+ Reply to Thread
Results 1 to 7 of 7

Help with code

Hybrid View

  1. #1
    Registered User
    Join Date
    07-31-2013
    Location
    Cumberland, Md
    MS-Off Ver
    Excel 2007
    Posts
    3

    Help with code

    Hey All,
    I need help with some coding

    Say I have cells A1 through A10 listed with names that coordinate with cells B1 through B10 with their addresses.

    I need to have an input box appear and ask for a persons name to be entered, once the name is entered and the user clicks ok, the excel sheet needs to only show the name of the people that the user inputed along with their address.

    If anyone could help, it would be awesome!

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Help with code

    You could instead put an x (or anything) in an unused column, and then autofilter on that column.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    07-31-2013
    Location
    Cumberland, Md
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Help with code

    Above was just a simplified example of my situation. In reality I have 2500 lines of data and filtering would be rediculous. I could just Control C and put my info in to find what I want. I need this to be clean looking

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Help with code

    In reality I have 2500 lines of data and filtering would be rediculous.
    Oh? Why is that?

    In the alternative, you could enter the name in a cell and use a lookup formula to retrieve the address.
    Last edited by shg; 07-31-2013 at 06:55 PM.

  5. #5
    Registered User
    Join Date
    07-31-2013
    Location
    Cumberland, Md
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Help with code

    Quote Originally Posted by shg View Post
    Oh? Why is that?

    In the alternative, you could enter the name in a cell and use a lookup formula to retrieve the address.
    Ha that is a smart way to go. Not the way I wanted, but could work for this.

    Thanks for the responses....I might just drop it into an access database

  6. #6
    Registered User
    Join Date
    07-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Help with code

    This is kind of a cheap way of doing it but it could work I just don't know your situation , or the other guys post is smart lol
    Sub hide()
    Dim a As Variant
    Dim lr As Long
    
    Worksheets("Sheet2").Range("A1").Clear
    
    Worksheets("Sheet2").Activate
    
    a = InputBox("Enter your full name.")
    
    lr = Sheets("sheet1").UsedRange.Rows.Count
    
    For i = 0 To lr
        If Sheets("Sheet1").Range("A1").Offset(i).Value = a Then
            Sheets("Sheet1").Range("A1:B1").Offset(i).Copy Sheets("Sheet2").Range("A1")
            Exit Sub
        End If
    Next i
    
    End Sub

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Help with code

    Please take a moment to read the forum rules and then amend your thread title to something descriptive of your problem. Once you have done this please send me a PM and I will remove this request.

    To change a Title on your post, click EDIT POST then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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. Replies: 2
    Last Post: 03-09-2013, 04:30 AM
  2. Adding Text to another cell VB code (Help Tweeking code) (Excel 2007)
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-06-2012, 11:37 AM
  3. Code for email alerts from excel isn't working, wrong code possibly?
    By jessthorogood in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-27-2012, 01:45 AM
  4. Replies: 2
    Last Post: 03-17-2011, 08:55 PM
  5. Replies: 0
    Last Post: 10-06-2006, 09:05 AM

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