Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Howdie all.
I've made a user form, and set it up with some combo boxes. Presently, my equations are asking for the input for 4 comboboxes. If a combobox is empty, it still inputs a blank value. I'd like to set it up so that if a value is not chosen for a combo box, it leaves that blank value out of the final input. Presently my equation reads: ActiveCell.value = Me.ComboBox1.value & Chr(10) & Me.ComboBox2.value & Chr(10) & Me.ComboBox3.value & Chr(10) & Me.ComboBox4.value For example, what I've got is combobox1 has a value, and then combobox2 and 3 are blank, then combobox4 has a value. Instead of placing two blanks in the input, I'd like it to only have the values from 1 and 4 input. I.e., Instead of A D I'd like A D How would I accomplish that? Thank you in advance for your helps. Best. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
dim str1 as string
if me.combobox1.value = "" then str1 = me.combobox1.value & chr(10) if me.combobox2.value = "" then str1 = str1 & me.combobox2.value & chr(10) if me.combobox3.value = "" then str1 = str1 & me.combobox3.value & chr(10) if me.combobox4.value = "" then str1 = str1 & me.combobox4.value & chr(10) str1 = left(str1,len(str1)-1) ActiveCell.value = str1 "Steve" wrote: Howdie all. I've made a user form, and set it up with some combo boxes. Presently, my equations are asking for the input for 4 comboboxes. If a combobox is empty, it still inputs a blank value. I'd like to set it up so that if a value is not chosen for a combo box, it leaves that blank value out of the final input. Presently my equation reads: ActiveCell.value = Me.ComboBox1.value & Chr(10) & Me.ComboBox2.value & Chr(10) & Me.ComboBox3.value & Chr(10) & Me.ComboBox4.value For example, what I've got is combobox1 has a value, and then combobox2 and 3 are blank, then combobox4 has a value. Instead of placing two blanks in the input, I'd like it to only have the values from 1 and 4 input. I.e., Instead of A D I'd like A D How would I accomplish that? Thank you in advance for your helps. Best. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Sam,
Thank you for the response. For a reason that I'm not quite clear on this leaves the affected cells blank, even if I choose specific values. In fact the only two cells receiving any input are one's not affected by this code. I also removed the left component thinkingthat might be the issue, and I get the same response. "Sam Wilson" wrote: dim str1 as string if me.combobox1.value = "" then str1 = me.combobox1.value & chr(10) if me.combobox2.value = "" then str1 = str1 & me.combobox2.value & chr(10) if me.combobox3.value = "" then str1 = str1 & me.combobox3.value & chr(10) if me.combobox4.value = "" then str1 = str1 & me.combobox4.value & chr(10) str1 = left(str1,len(str1)-1) ActiveCell.value = str1 "Steve" wrote: Howdie all. I've made a user form, and set it up with some combo boxes. Presently, my equations are asking for the input for 4 comboboxes. If a combobox is empty, it still inputs a blank value. I'd like to set it up so that if a value is not chosen for a combo box, it leaves that blank value out of the final input. Presently my equation reads: ActiveCell.value = Me.ComboBox1.value & Chr(10) & Me.ComboBox2.value & Chr(10) & Me.ComboBox3.value & Chr(10) & Me.ComboBox4.value For example, what I've got is combobox1 has a value, and then combobox2 and 3 are blank, then combobox4 has a value. Instead of placing two blanks in the input, I'd like it to only have the values from 1 and 4 input. I.e., Instead of A D I'd like A D How would I accomplish that? Thank you in advance for your helps. Best. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Combox Help! | Excel Programming | |||
Combox In Form | Excel Programming | |||
combox question | Excel Programming | |||
Combox Box and 3 worksheets | Excel Programming | |||
Combox Box and 3 worksheets | Excel Programming |