ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Data from Combo Box (https://www.excelbanter.com/excel-programming/418378-data-combo-box.html)

Sue

Data from Combo Box
 
Hi all

I got the following code off this forum

Private Sub UserForm_Initialize()
Cb2.List = ActiveSheet. _
Range("A2:C200").Value
End Sub

ComboBox Cb2 displays the info when opened
e.g. Name | Sex | DOB

I have two textboxes on the Userform
Tb1 & Tb2
I need Tb1 & Tb2 to fill with the data from Cb2

Sex | DOB

Everytime I click on a different name - it they will change automatically
I can then add them to a new sheet Named "Correct" in Cols E & F respectively
been at it a couple of hours and I need you experts to guide me


--
Many Thanks

Sue

Rick Rothstein

Data from Combo Box
 
Add this event procedure to your UserForm's code window...

Private Sub Cb2_Click()
Tb1.Text = Cb2.Column(1)
Tb2.Text = Cb2.Column(2)
End Sub

--
Rick (MVP - Excel)


"Sue" wrote in message
...
Hi all

I got the following code off this forum

Private Sub UserForm_Initialize()
Cb2.List = ActiveSheet. _
Range("A2:C200").Value
End Sub

ComboBox Cb2 displays the info when opened
e.g. Name | Sex | DOB

I have two textboxes on the Userform
Tb1 & Tb2
I need Tb1 & Tb2 to fill with the data from Cb2

Sex | DOB

Everytime I click on a different name - it they will change automatically
I can then add them to a new sheet Named "Correct" in Cols E & F
respectively
been at it a couple of hours and I need you experts to guide me


--
Many Thanks

Sue



Sue

Data from Combo Box
 
Hi Rick

Isn't it easy when you know how??

Works a treat
--
Many Thanks

Sue


"Rick Rothstein" wrote:

Add this event procedure to your UserForm's code window...

Private Sub Cb2_Click()
Tb1.Text = Cb2.Column(1)
Tb2.Text = Cb2.Column(2)
End Sub

--
Rick (MVP - Excel)


"Sue" wrote in message
...
Hi all

I got the following code off this forum

Private Sub UserForm_Initialize()
Cb2.List = ActiveSheet. _
Range("A2:C200").Value
End Sub

ComboBox Cb2 displays the info when opened
e.g. Name | Sex | DOB

I have two textboxes on the Userform
Tb1 & Tb2
I need Tb1 & Tb2 to fill with the data from Cb2

Sex | DOB

Everytime I click on a different name - it they will change automatically
I can then add them to a new sheet Named "Correct" in Cols E & F
respectively
been at it a couple of hours and I need you experts to guide me


--
Many Thanks

Sue





All times are GMT +1. The time now is 05:12 AM.

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