+ Reply to Thread
Results 1 to 4 of 4

drop down then populate

  1. #1
    Candyk
    Guest

    drop down then populate

    Hi all, please help. I am not sure what I want is possible, any help will be
    MUCH appreciated. I have a drop down list....say 8 items 1-8.
    Simple drop down so far. Now, each one of these 8 items has a corresponding
    "range" of stuff (6 columns wide by 27 rows deep of data) on other worksheets
    within the same book.
    I want to be able to choose one of the items from the drop down and
    when the item is choosen,and displays in the cell as the "chioce" in the
    drop down box,
    a "range" of cells (G7:L34 for example-named as a range
    "number_8_specifications")
    automatically fills an area under the drop down box.
    (the area on sheet one with the drop down box to fill is the same size as
    the source data G7:L34)
    I don't know where to begin...
    I am greatful for any help and direction.
    Candice

  2. #2
    Otto Moehrbach
    Guest

    Re: drop down then populate

    Candice
    What you want to do is quite common. There are many ways we can do this
    so I'll just make some assumptions and show you one way. Say your 8 items
    are all "Number_X" where "X" is 1 to 8.
    Also say that your 8 areas or ranges are named "Number_X_Specifications with
    "X" again being 1-8.
    We will use a Workbook_Change event macro to pick up on the change in the
    contents of the drop-down cell, and a regular macro to copy/paste. Let's
    say that cell A1 is the drop-down cell and the first cell in the area below
    A1 is A2. So we want the appropriate range to be copied and pasted to A2.
    Those macros would look like this:
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Count > 1 Then Exit Sub
    If IsEmpty(Target.Value) Then Exit Sub
    If Target.Address(0, 0) = "A1" Then _
    Call CopyData(Target.Value)
    End Sub

    Sub CopyData(aa As String)
    Application.EnableEvents = False
    Range(aa & "_Specifications").Copy [A2]
    Application.EnableEvents = True
    End Sub

    The first macro must be placed in the sheet module of the sheet that has the
    drop-down cell. You can access that module by right-clicking on the sheet
    tab and selecting View Code. Paste that macro into that module.
    The second macro goes in a standard module.
    If you wish, send me an email with your email address and I'll send you the
    small file I developed for this with all the code properly placed. My email
    address is [email protected]. Remove the "nop" from this address. HTH
    Otto
    "Candyk" <[email protected]> wrote in message
    news:[email protected]...
    > Hi all, please help. I am not sure what I want is possible, any help will
    > be
    > MUCH appreciated. I have a drop down list....say 8 items 1-8.
    > Simple drop down so far. Now, each one of these 8 items has a
    > corresponding
    > "range" of stuff (6 columns wide by 27 rows deep of data) on other
    > worksheets
    > within the same book.
    > I want to be able to choose one of the items from the drop down and
    > when the item is choosen,and displays in the cell as the "chioce" in the
    > drop down box,
    > a "range" of cells (G7:L34 for example-named as a range
    > "number_8_specifications")
    > automatically fills an area under the drop down box.
    > (the area on sheet one with the drop down box to fill is the same size as
    > the source data G7:L34)
    > I don't know where to begin...
    > I am greatful for any help and direction.
    > Candice




  3. #3
    Biff
    Guest

    Re: drop down then populate

    Hi!

    Assume the drop down is in cell A1.

    Use the named ranges for the selections in the drop down.

    Then select a range of cells 6 columns by 27 rows where you want the data to
    appear and enter this formula as an array using the key combination of
    CTRL,SHIFT,ENTER:

    =IF(A1="","",INDIRECT(A1))

    Biff

    "Candyk" <[email protected]> wrote in message
    news:[email protected]...
    > Hi all, please help. I am not sure what I want is possible, any help will
    > be
    > MUCH appreciated. I have a drop down list....say 8 items 1-8.
    > Simple drop down so far. Now, each one of these 8 items has a
    > corresponding
    > "range" of stuff (6 columns wide by 27 rows deep of data) on other
    > worksheets
    > within the same book.
    > I want to be able to choose one of the items from the drop down and
    > when the item is choosen,and displays in the cell as the "chioce" in the
    > drop down box,
    > a "range" of cells (G7:L34 for example-named as a range
    > "number_8_specifications")
    > automatically fills an area under the drop down box.
    > (the area on sheet one with the drop down box to fill is the same size as
    > the source data G7:L34)
    > I don't know where to begin...
    > I am greatful for any help and direction.
    > Candice




  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello CandyK,

    To use this macro code the choices need to be the names of the Named Ranges. I can alter the code if you decide to use more descripitive and user friendly names. Copy the macro into a standard VBA code module and then assign the macro to your Drop Down Box. The data from the selected Named Range will be copied into cells G7:L34 on the worksheet the Drop Down Box is on.

    To Add a Code Module:
    1) Copy the macro code to the clipboard using Ctrl + C.
    2) Open the Excel Workbook the macro will be used in.
    3) Press Alt+F11 to launch the VBA Editor.
    4) Press Alt+I to view the Insert Menu.
    5) Press M to insert a Module into your Workbook.
    6) Press Ctrl+V to Paste the code into the Module.
    7) Press Ctrl+S to Save the Macro.
    8) Press Alt+Q to Quit the VBA Editor and return to Excel.


    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

+ 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