ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Taking Combobox data... (https://www.excelbanter.com/excel-programming/291706-taking-combobox-data.html)

Paul

Taking Combobox data...
 
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

Robert Couchman[_4_]

Taking Combobox data...
 
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

Nick Cranham

Taking Combobox data...
 
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

"Paul" wrote in message
...
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




Robert Couchman[_4_]

Taking Combobox data...
 

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

Paul

Taking Combobox data...
 
Thanks for your solution.
Paul

-----Original Message-----

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
.


Paul

Taking Combobox data...
 
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

"Paul" wrote in

message
...
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



.



All times are GMT +1. The time now is 05:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com