PC Review


Reply
Thread Tools Rate Thread

Combo box the exludes blanks

 
 
EP007
Guest
Posts: n/a
 
      7th Jan 2008
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 With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      7th Jan 2008
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
 
Reply With Quote
 
JRForm
Guest
Posts: n/a
 
      7th Jan 2008
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo Box allows blanks jovii Microsoft Access 2 27th Jul 2009 07:40 PM
Variable length array that exludes (possible) blanks in the middle Emma Microsoft Excel Misc 1 21st Jan 2009 12:36 PM
Adding 'Blanks' & 'Non-blanks' to a filter combo box Robin Microsoft Access VBA Modules 2 2nd Aug 2006 05:48 PM
Blanks in Combo Box Lookup =?Utf-8?B?c21ib3lk?= Microsoft Access Forms 2 6th Nov 2004 03:54 AM
How do I conver 3/15/02 into a pivot value that EXLUDES the day, keeps MM/YY? John Jones Microsoft Excel Worksheet Functions 2 3rd Oct 2003 02:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:45 PM.