Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default combobox, and chr(10)

dim str as string

if not Me.ComboBox1.value ="" then str = str & me.combobox1.value & chr(10)
if not Me.ComboBox2.value ="" then str = str & me.combobox2.value & chr(10)
if not Me.ComboBox3.value ="" then str = str & me.combobox3.value & chr(10)
if not Me.ComboBox4.value ="" then str = str & me.combobox4.value & chr(10)

activecell.value = left(str,len(str)-1)

"Steve" wrote:

Morning all.
last week-- the 4th, I'd posted about this and while I received a response
it didn't actually solve my issue.
Below is my initial post from the 4th. (this is rather extended-- so please
forgive me up front. I'm trying to avoid repeating what I've done already)

----------------------------------------
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.
--------------------------------------------
Here is what I wound up using, and it still doesn't quite do what I'm
looking to accomplish. Definitely closer, but not exactly it.

=============

IIf(Me.ComboBox9.value = "", "", Me.ComboBox9.value) & _
IIf(Me.ComboBox11.value = "", "", Chr(10) & Chr(10) &
Me.ComboBox11.value) & _
IIf(Me.ComboBox12.value = "", "", Chr(10) & Chr(10) &
Me.ComboBox12.value) & _
IIf(Me.ComboBox13.value = "", "", Chr(10) & Chr(10) &
Me.ComboBox13.value)

or

IIf(Me.ComboBox10.value = "", "", Me.ComboBox10.value) & _
IIf(Me.ComboBox15.value = "", "", Chr(10) & Chr(10) &
Me.ComboBox15.value)

=====================

Presently, what I'm getting is:
A

B
which, while I want this, in other uses where I have four IIf's, I get
A

B

C

D

when I want

A
B
C
D

Thus, my goal is that when I only have one truepart I want

A

when I have two truepart, I want

A
B

or

A

C

or

A

D

And if I have 3 truepart for iif I want

A
B
C

or

A
B

D

or

A

C
D

However, what I get with the present configuration I'm getting
A

B

C

D

I again apologize for this being so protracted a post. I hope that it's
clear. If not, please ask me questions to help clarify.

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
fill combobox depending on selection from another combobox Adam Francis Excel Discussion (Misc queries) 2 July 24th 08 07:39 PM
Combobox items determined by the selection in another combobox Alerion Excel Programming 2 September 13th 06 01:07 PM
Combobox options based on the input of another combobox afmullane[_5_] Excel Programming 1 May 3rd 06 01:44 PM
ComboBox list reliant on the entry from a different ComboBox ndm berry[_2_] Excel Programming 4 October 4th 05 04:40 PM
How Do I Load A ComboBox RowSource From The Results Of Another ComboBox Minitman[_4_] Excel Programming 3 October 26th 04 07:58 PM


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

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

About Us

"It's about Microsoft Excel"