ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   user form, set values (https://www.excelbanter.com/excel-programming/428164-user-form-set-values.html)

Steve

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.

Gary Brown[_5_]

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.


Steve

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.



All times are GMT +1. The time now is 04:46 PM.

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