Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Displaying data from value of text box

  1. #1
    New Member
    Join Date
    May 2002
    Location
    Baltimore
    Posts
    29
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    The phone number text box and address text box are on the same form. The address needs to be displayed as soon as the phone number is entered. If the value of my phone number in the text box, equals a phone number in another sheet (Phone Table), then the address should display in the address text box below the phone number text box.

  2. #2
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Something like this (note: I've not tested this and I'm just typing this into the forum, so if it works first time, that's amazing) I've also called your textboxes - txtPhone and txtAddress respectively and I've assume that the Phone number is in the column to the right of the address. i.e. if Phone number is in Column A, Address is in Column B:


    Dim oRange As Range

    Set oRange = Sheets("Phone Table").UsedRange.Find(What:=txtPhone.Text)

    If Not oRange is Nothing then
    txtAddress.Text = oRange.Offset(1,0).Value
    End if


    Put this code on a button click event or something.

    If you need any help just repost.

    HTH

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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