Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
user form, set values
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
user form, set values
Something like this will put the value of your combo box into cell C10...
Range("C10").Value = Me.ComboBox1.Value -- Hope this helps. If it does, please click the Yes button. Thanks in advance for your feedback. Gary Brown "Steve" wrote: 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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
user form, set values
Bingo....
Thank you Gary. Have a great afternoon. "Gary Brown" wrote: Something like this will put the value of your combo box into cell C10... Range("C10").Value = Me.ComboBox1.Value -- Hope this helps. If it does, please click the Yes button. Thanks in advance for your feedback. Gary Brown "Steve" wrote: 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Maintaing public array values in a user form | Excel Programming | |||
User form return values | Excel Programming | |||
user form, saving values | Excel Programming | |||
returning values from a User Form | Excel Programming | |||
Cell Values On User Form | Excel Programming |