#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default combox box

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default combox box

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default combox box

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combox Help! PumaMan Excel Programming 2 March 18th 09 06:00 PM
Combox In Form Arunpd Excel Programming 5 March 17th 08 07:04 AM
combox question Gary Keramidas Excel Programming 3 August 17th 06 11:57 PM
Combox Box and 3 worksheets craig456[_2_] Excel Programming 0 March 24th 06 03:07 PM
Combox Box and 3 worksheets craig456 Excel Programming 0 March 24th 06 03:06 PM


All times are GMT +1. The time now is 07:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"