Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Default Blank Spaces on ComboBox

Hi There,

I hope you are all well.

I have a table that countains 3 columns as following:

- from B3:B22 we have a reference number
- from C3:C22 we have Employee name
- from D3:D22 we have availability (two options: "Yes" or "No").

The Reference column is empty with an "IF" formula and the criteria is:
e.g. IF cell "D3" is "Yes", then the cell "B3" shows a reference such as "001" and so on.

I have created a UserForm to send an email to employees that have "Yes" on column "D".

For that, I have created a ComboBox to choose which employee to send the email.

The problem is, I can see the ones that shows the reference, but I can also see blank cells on the ComboBox.

Is there a way to hide/delete the empty spaces from the ComboBox so I can only see and choose the ones that are visible?

As I am not able to attach the current file, I have attached a print screen so you can see it.

Your assistance on this will be highly appreciated.

Best regards,
Filipe Oliveira
Attached Images
 
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Blank Spaces on ComboBox

If you read the employee list into an array then you can use AddItem to
populate the combobox via a For...Next loop, *if* the array element
isn't empty.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #3   Report Post  
Junior Member
 
Posts: 20
Default

Quote:
Originally Posted by Filipe Oliveira View Post
Hi There,

I hope you are all well.

I have a table that countains 3 columns as following:

- from B3:B22 we have a reference number
- from C3:C22 we have Employee name
- from D3:D22 we have availability (two options: "Yes" or "No").

The Reference column is empty with an "IF" formula and the criteria is:
e.g. IF cell "D3" is "Yes", then the cell "B3" shows a reference such as "001" and so on.

I have created a UserForm to send an email to employees that have "Yes" on column "D".

For that, I have created a ComboBox to choose which employee to send the email.

The problem is, I can see the ones that shows the reference, but I can also see blank cells on the ComboBox.

Is there a way to hide/delete the empty spaces from the ComboBox so I can only see and choose the ones that are visible?

As I am not able to attach the current file, I have attached a print screen so you can see it.

Your assistance on this will be highly appreciated.

Best regards,
Filipe Oliveira
Hi Folipe,

Add this code to your form initialize event:

Private Sub UserForm_Initialize()
'


'Assumes you have named the reference as "Reference"
For Each cell In Range("Reference")
If cell.Value < "" Then
ComboBox1.AddItem cell.Value
End If
Next cell

End Sub

Regards,
Gizzmo
Attached Files
File Type: zip ExcelBanterFilipeOliveira.zip (11.1 KB, 24 views)
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
Removing Blank spaces? Digital2k Excel Programming 3 May 2nd 07 04:41 AM
ranking with some blank spaces LRR via OfficeKB.com Excel Worksheet Functions 7 April 16th 06 03:04 PM
Blank Spaces on Sort Xiazer Excel Discussion (Misc queries) 0 February 28th 06 09:56 AM
Blank spaces Scurloc Excel Discussion (Misc queries) 4 December 22nd 05 05:08 PM
Blank spaces in a listbox Soundman Excel Discussion (Misc queries) 3 August 17th 05 02:13 PM


All times are GMT +1. The time now is 05:15 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"