|
Anthony's VBA Forum Where the knowledge is shared |
|
|
View previous topic :: View next topic |
Author |
Message |
1cainr
Joined: 05 Jan 2009 Posts: 1
|
Posted: Mon Jan 05, 2009 1:55 pm Post subject: Contents of combo box on a form from a sheet in excel, how?? |
|
|
Hello,
I have created a combo box on a form in excel but now what i want to do it is...
When i click on the combo box to select some data, i want those to come from a sheet so they can be changed if needed to, example, sheet 1, range a1:a10.
Also but would like to get the first bit working but i have a text box on the form as well, so what ever is selected in the combo box, the data on the same row as in the combo box is put into there. example: select cat in combo box and in the text box will appear ginger (which is in the excel spreadsheet on the same row as cat) |
|
Back to top |
|
|
Kenneth Hobson Gold Member
Joined: 25 Mar 2007 Posts: 21 Location: Tecumseh, OK
|
Posted: Sun Feb 15, 2009 4:58 pm Post subject: |
|
|
Welcome to the forum!
[code]
Private Sub UserForm_Initialize()
ComboBox1.RowSource = "A1:A10"
End Sub
Private Sub ComboBox1_Change()
TextBox1.ControlSource = "A" & ComboBox1.ListIndex + 1
TextBox1.SetFocus
End Sub
[/code] |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|