Results 1 to 8 of 8

Thread: Complex Problem!!!!

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    18

    Complex Problem!!!!

    i have a sheet with many different artists on and venues.
    on a user form i have 2 comboboxes, when you choose an artist in the first combo box, i would like it to only display the appropiate venues for that artist.

    this is the formula i have so far

    Sheets("Concerts (2)").Select
    If ConcertComboBox = "Arctic Monkeys" Then
    VenueComboBox.RowSource = ARC_VENUE
    ElseIf ConcertComboBox = "Babyshambles" Then
    VenueComboBox = "WATEVA"
    ElseIf ConcertComboBox = "Bloc Party" Then
    VenueComboBox.RowSource = "Liverpool Academy" & "Manchester Apollo"
    ElseIf ConcertComboBox = "Blondie" Then
    VenueComboBox = "St David's Hall"
    ElseIf ConcertComboBox = "Clor" Then
    VenueComboBox.RowSource = "Coloseum" & "Waterfront"
    ElseIf ConcertComboBox = "Dead 60s" Then
    VenueComboBox.RowSource = "Carling Academy 2 Birmingham" & "Waterfront"
    ElseIf ConcertComboBox = "Duke Spirit" Then
    VenueComboBox.RowSource = "Carling Academy 2 Birmingham"
    ElseIf ConcertComboBox = "Editors" Then
    VenueComboBox.RowSource = "Carling Academy Brixton"
    ElseIf ConcertComboBx = "Futureheads" Then
    VenueComboBox.RowSource = "Carling Academy Brixton" & "Norwich UEA" & "Leeds Uni Union"
    ElseIf ConcertComboBox = "Goldfrapp" Then
    VenueComboBox.RowSource = "Carling Apollo" & "Leeds Uni Union"
    ElseIf ConcertComboBox = "Kid Carptet" Then
    VenueComboBox.RowSource = "Roadmender" & "Bar Academy Birmingham"
    ElseIf ConcertComboBox = "Paddingtons" Then
    VenueComboBox.RowSource = "Roadmender" & "Coloseum"
    ElseIf ConcertComboBox = "Test Icicles" Then
    VenueComboBox.RowSource = "Birmingham Barfly" & "Rivermead" & "Blank Canvas"
    ElseIf ConcertComboBox = "The Go! Team" Then
    VenueComboBox.RowSource = "Carling Academy Liverpool" & "The Plug"
    ElseIf ConcertComboBox = "Thee Unstrung" Then
    VenueComboBox.RowSource = "Coloseum"
    End If

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    18

    Re: Complex Problem!!!!

    if you have any questions that would help you answer the question then please ask!

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Complex Problem!!!!

    Excel VBA question moved to Office Development.

  4. #4
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Complex Problem!!!!

    Ryan
    One way to do this is to create a crossreference list of Bands to Venues. This list should contain 2 columns only and have an entry for each venue that each band can play at.
    Then when the "Band" combo is change you can run an event macro that populates the "Venue" combo with the matching entries from the crossreference table.
    Here is some sample code. You will need to change the names of the combos to your names.
    Also, if you decide to store the xref list on a seperate worksheet, you will need to use that sheet name in the setting of the Xrefrange variable.

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub ComboBox1_Change()
    4. Dim TheBand As String
    5. Dim XrefRange As Range
    6. Dim RowNum As Integer
    7.    
    8.     'Get the Selected Band
    9.     TheBand = Me.ComboBox1.Value
    10.    
    11.     'Reset the 2nd Combobox
    12.     Me.ComboBox2.Clear
    13.    
    14.     'The range containing the band to venue crossreference
    15.     Set XrefRange = Range("BANDVENUE")
    16.    
    17.     With XrefRange
    18.         'Loop through the Xref range
    19.         For RowNum = 1 To .Rows.Count
    20.             'Find Entries for the selected band
    21.             If .Cells(RowNum, 1) = TheBand Then
    22.                 'Add the venue to the 2nd Combobox
    23.                 Me.ComboBox2.AddItem .Cells(RowNum, 2)
    24.             End If
    25.         Next RowNum
    26.     End With
    27.    
    28.     'Select the 1st possible venue
    29.     Me.ComboBox2.ListIndex = 0
    30. End Sub
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  5. #5
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Complex Problem!!!!

    Ryan
    Per your PM, here is a sample of how this code works.
    Attached Files Attached Files
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    18

    Re: Complex Problem!!!!

    thank you very much!
    Ryan

  7. #7
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Complex Problem!!!!

    Quote Originally Posted by ryanesx7
    Hi sorry to bother you, still on that project, diong the write up bit now of how i have done it, was wondering about that file in the post:

    how do i name a combo box??
    also, in the VB code what does the me.combobox1.value mean???

    thanks in anticipation

    Ryan

    To name a combobox:
    Right-click on the Combo, select properties and type in a new name (it will be the first property in the Alphabetic list.

    what does the me.combobox1.value mean?
    As this procedure is in the code page for a worksheet object...
    The me refers to the worksheet
    The combobox1 refer to a combobox called "combobox1" on the worksheet.
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    18

    Re: Complex Problem!!!!

    here is the spreadsheet Dkenny if you need it, thanks again

    Ry
    Attached Files Attached Files

Posting Permissions

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



Click Here to Expand Forum to Full Width