Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Combo box the exludes blanks

Hi

Thank you in advance to anyone who can help.

I'm trying to create a combo box that is linked to a range on a worksheet
that is populated by a vlookup. Depending on what is being looked up blanks
appear in the data range, how do I get the combobox not to show these blanks?

Many thanks

Euan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Combo box the exludes blanks

And you're populating the combobox via code?

You could loop through the range and check to see what's in each cell.

I guessed that you were using a combobox in a Userform (in the VBE):

Option Explicit
Private Sub UserForm_Initialize()
Dim myCell As Range
Dim myRng As Range

With Worksheets("sheet1")
Set myRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp))
End With

With Me.ComboBox1
.Clear
.RowSource = ""
For Each myCell In myRng.Cells
If Trim(myCell.Value) = "" Then
'skip it
Else
.AddItem myCell.Value
End If
Next myCell
End With
End Sub


EP007 wrote:

Hi

Thank you in advance to anyone who can help.

I'm trying to create a combo box that is linked to a range on a worksheet
that is populated by a vlookup. Depending on what is being looked up blanks
appear in the data range, how do I get the combobox not to show these blanks?

Many thanks

Euan


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Combo box the exludes blanks

Do you have any code developed yet?

"EP007" wrote:

Hi

Thank you in advance to anyone who can help.

I'm trying to create a combo box that is linked to a range on a worksheet
that is populated by a vlookup. Depending on what is being looked up blanks
appear in the data range, how do I get the combobox not to show these blanks?

Many thanks

Euan

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
Variable length array that exludes (possible) blanks in the middle Emma Excel Discussion (Misc queries) 1 January 21st 09 12:36 PM
copy range of cells with blanks then paste without blanks justaguyfromky Excel Programming 5 September 3rd 06 11:23 PM
copy range of cells with blanks then paste without blanks justaguyfromky Excel Worksheet Functions 1 September 3rd 06 07:56 PM
Fill combo box ignoring blanks Shannon Excel Programming 2 August 11th 06 02:37 PM
Paste Special Skip Blanks not skipping blanks, but overwriting... gsrosin Excel Discussion (Misc queries) 0 February 22nd 05 03:33 AM


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