+ Reply to Thread
Results 1 to 3 of 3

List Box with macro

  1. #1
    Registered User
    Join Date
    08-12-2004
    Posts
    14

    List Box with macro

    I have 100 clients and store their data on one sheet.


    Example: Client A's data would be located at b230:k254.

    Client B's data would be located at b260:k284

    I would like to develop a List Box that would contain all of my clients.
    Once a client is highlighted, I would like to press enter and have a
    macro take me to the selected clients data.

    Can someone please point me in the right direction to accomplish this task.

    Thanks,

    Bob

  2. #2
    Richard Buttrey
    Guest

    Re: List Box with macro

    On Mon, 27 Feb 2006 10:14:34 -0600, VETcalc
    <VETcalc.23wbiz_1141056902.9177@excelforum-nospam.com> wrote:

    >
    >I have 100 clients and store their data on one sheet.
    >
    >
    >Example: Client A's data would be located at b230:k254.
    >
    >Client B's data would be located at b260:k284
    >
    >I would like to develop a List Box that would contain all of my
    >clients.
    >Once a client is highlighted, I would like to press enter and have a
    >macro take me to the selected clients data.
    >
    >Can someone please point me in the right direction to accomplish this
    >task.
    >
    >Thanks,
    >
    >Bob


    Probably several ways, but one that springs to mind is:

    Create a unique list of your client names/codes and name the range say
    "Clients"

    In the RowSource property of the list box, enter the name "Clients"

    I'm going to assume here that your data has the client name/code in
    column A of sheet1. Change the code as necessary

    In say the Click event of the ListBox, enter the following

    Private Sub ListBox1_Click()
    Dim stMyClient As String

    stMyClient = UserForm1.ListBox1
    Worksheets("sheet1").Activate
    Range("a1").Select
    Columns("A:A").Find(What:=stMyClient, After:=ActiveCell).Activate

    End Sub

    Hope this gives a general idea.





    Richard Buttrey
    __

  3. #3
    Registered User
    Join Date
    08-12-2004
    Posts
    14
    Richard,

    Thank you!

    Bob

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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