combobox data doesn't take affect right away

C

Charlie

On a userform, a combobox with choices 1 through 10. I have the control
source set to sheet1!A10, but in the field A10, nothing happens until I leave
the focus from the combobox. So I have to click on some other control, or
close the form. I need my chooice from the combobox to take affect
immiedately, because it affects others controls on the form. Can this be
done?
 
C

carlo

You can use the combobox change event:

Private Sub ComboBox1_Change()
Worksheets("sheet1").Range("a10") = Me.ComboBox1.Value
End Sub

hth

Carlo
 
C

Charlie

Do I just put this private sub on a seperate module? Do I call this sub from
the form or the combobox1 to make it work? Or do I replace the control
source of this combobox with something?
Thanks.
 
C

carlo

Sorry didn't make myself clear.

In the vb-editor, double click on your combobox, that should open the
code of your userform, and following lines should be displayed now:

Private Sub ComboBox1_Change()

End Sub

Although ComboBox1 could be slightly different depending on the name
you gave your ComboBox.

between those lines you can now enter this:
Worksheets("sheet1").Range("a10") = Me.ComboBox1.Value

Don't forget to adjust the names of the sheet and the range and the
combobox1 otherwise it won't work.

hope that was a little clearer

Carlo
 
C

carlo

You're welcome

if you have any other question, just ask.
It takes a while until you get you're head around stuff like that.
There are some good tutorials on the web, that you might want to check
out.

Cheers Carlo
 
C

Charlie

....There are some good tutorials on the web, that you might want to check
out.
....any in particular you'd recomend?
thanks.
 
C

carlo

Hi Charlie

try to enter "excel userform tutorial" in google.
The first page will get you at least 8 good tutorials.

hth

Carlo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top