Taking Combobox data...

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Hi, using XL 2000

I have 4 comboboxes, named CB1..CB4

When each is selected, an 8 character part number is
dynamically built.

Each CB holds 2 characters, so my part number ouptut into
Label1, needs to take the string format of 'A1B2C3D4'

This is the tricky part, if a user changes any CB, I need
the characters in the respective position to dynamically
change.

Example; if CB2 is changed from 'B2' to 'B8' I need the
part number output string to change accordingly; A1B8C3D4

Hope this make some sense.

Thanks, Paul
 
Hi,

hope this helps!

if you use this code for your combo boxes, i dont know
what you want to reference the comboboxes to though!

Private Sub CB1_afterupdate()
TB1 = CB1 + CB2 + CB3 + CB4
End Sub
Private Sub CB2_afterupdate()
TB1 = CB1 + CB2 + CB3 + CB4
End Sub
Private Sub CB3_afterupdate()
TB1 = CB1 + CB2 + CB3 + CB4
End Sub
Private Sub CB4_afterupdate()
TB1 = CB1 + CB2 + CB3 + CB4
End Sub


thank you,

Robert Couchman
 
Paul,
If you 4 cbo's have their output linked a cell each, then your part number
would just be:

=A1 & A2 & A3 & A4

Or if they are on a userform they in each _Change event call MadePartNumber

Private Function MadePartNumber () As String
MadePartNumber=ComboBox1.Text & ComboBox2.Text & ComboBox3.Text &
ComboBox4.Text
End Function

NickHK
 
Private Sub CB1_afterupdate()
TB1 = CB1 + CB2 + CB3 + CB4
End Sub
Private Sub CB2_afterupdate()
TB1 = CB1 + CB2 + CB3 + CB4
End Sub
Private Sub CB3_afterupdate()
TB1 = CB1 + CB2 + CB3 + CB4
End Sub
Private Sub CB4_afterupdate()
TB1 = CB1 + CB2 + CB3 + CB4
End Sub

sorry forgot to mention that i was updating a textbox
(TB1) and not a label, but im sure that can be easily
changed!

Thank you,

Robert Couchman
 
Thanks for your solution.
Paul
-----Original Message-----


sorry forgot to mention that i was updating a textbox
(TB1) and not a label, but im sure that can be easily
changed!

Thank you,

Robert Couchman
.
 
Thanks for your solution.
Paul
-----Original Message-----
Paul,
If you 4 cbo's have their output linked a cell each, then your part number
would just be:

=A1 & A2 & A3 & A4

Or if they are on a userform they in each _Change event call MadePartNumber

Private Function MadePartNumber () As String
MadePartNumber=ComboBox1.Text & ComboBox2.Text & ComboBox3.Text &
ComboBox4.Text
End Function

NickHK




.
 
Back
Top