user form, set values

S

Steve

morning all.
My continuing saga of a user form.

I've made 10 comboboxes, and now that I've got the lists in them to be
populated via initialization (thank you JLGWhiz!), I need to start having the
combbox selections be input into a selected cell in a worksheet.

My previous user forms haven't used comboboxes (I used RefEdit boxes), so
I'm not sure if I use the same general code, or another set of terms.
In my previous user forms, I did:
-------------------------------------------------
Set MyRng3 = Nothing
On Error Resume Next
Set MyRng3 = Range(RefEdit3.Text)
On Error GoTo 0
If MyRng3 Is Nothing Then
Exit Sub 'user hit cancel.
End If

'and

myFormula3 = "=if(" & MyRng3.Address(rowabsolute:=False,
columnabsolute:=False, external:=True) & "=" _
& ACTotal & ",""ok""," & ACTotal & "-" & MyRng3.Address(rowabsolute:=False,
columnabsolute:=False, external:=True) & ")"

'where this was a formula that I input based on manual-cursor cell/range
'selections.

-------------------------------------------------------------------------
Now it seems like I need to do the following to get my desired input.
--------------------------------------------------------------------------------

Set myCell1 = Nothing
On Error Resume Next
Set myCell1 = Range(ComboBox1.value & Chr(10) & ComboBox2.value & Chr(10) &
ComboBox3.value & Chr(10) & ComboBox4.value)
On Error GoTo 0
If myCell1 Is Nothing Then
Exit Sub 'user hit cancel.
End If


ActiveCell.Select
myCell1 = myCell1
'and no, I'm not certain this last statement is correct.
----------------------------------------------------------
However... this did not work. So.... my question is:
what do I write here to input the values selected in my comboboxes into the
selected cell?

Thank you.
 
G

Gary Brown

Something like this will put the value of your combo box into cell C10...
Range("C10").Value = Me.ComboBox1.Value
 

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

Similar Threads


Top