Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 2 comboboxes working 2gether

Teams...............BX#1.....BX#2...etc....etc.... .etc
BX#1...................AA.......AW
BX#2...................CB.......CR
BX#3...................GB.......ET
BX Sites...............HC.......JV
BX 149.................JH.......MP
MH#1...................LJ.......NG
MH#2...................LR......TS
MH Sites...............MP.....TP

I need help making 2 comboboxes work together in an "userform". I don't
even know how to start with the VBA code. I can populate the 1st
combobox with the team list... but I need that when the user selects a
team, that the corresponding information is populated in the 2nd
combobox.

For example, if the user selects "BX#1", then the BX#1 list is
populated in the 2nd combobox. If user selects "MH Sites" then the MH
Sites list is populated and so on.

There are 24 different list depending on 1st selection.

Please experts, help me!

- Larry -
VBA Amateur


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 2 comboboxes working 2gether

Can anyone help?

- Larry -
VBA Amateu

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 2 comboboxes working 2gether

Help

- Larry -
VBA Amateu

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 2 comboboxes working 2gether

How about something like:

Option Explicit
Dim blkProc As Boolean
Private Sub ComboBox1_Change()

Dim FoundCell As Range
Dim myRng As Range

blkProc = True
Me.ComboBox2.Clear
blkProc = False

If Me.ComboBox1.ListIndex = -1 Then
Exit Sub
Else
With Worksheets("sheet1")
With .Rows(1)
Set FoundCell = .Cells.Find(what:=Me.ComboBox1.Value, _
after:=.Cells(.Cells.Count), _
LookIn:=xlValues, lookat:=xlWhole, _
MatchCase:=False)
If FoundCell Is Nothing Then
MsgBox "Design error!" & vbLf & "please call Larry @xxxx"
Exit Sub
End If
End With

Set myRng = .Range(.Cells(2, FoundCell.Column), _
.Cells(.Rows.Count, FoundCell.Column).End(xlUp))
Me.ComboBox2.List = myRng.Value

End With
End If

End Sub

Private Sub ComboBox2_Change()
If blkProc Then Exit Sub
MsgBox "hi"
End Sub

Private Sub UserForm_Initialize()

Dim myRng As Range
With Worksheets("Sheet1")
Set myRng = .Range("a2", .Cells(.Rows.Count, "A").End(xlUp))
End With

Me.ComboBox1.List = myRng.Value

End Sub


"nrage21 <" wrote:

Help

- Larry -
VBA Amateur

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
comboboxes [email protected] uk Excel Discussion (Misc queries) 1 December 6th 09 05:07 PM
Comboboxes mr-bear New Users to Excel 1 November 21st 06 10:05 AM
Need help with ComboBoxes. rosemary New Users to Excel 2 July 9th 05 12:19 AM
Comboboxes Angeliki Excel Programming 1 March 3rd 04 12:00 PM
Comboboxes David W[_3_] Excel Programming 1 August 29th 03 11:13 PM


All times are GMT +1. The time now is 04:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"