Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Can Combobox range be variable?

I have a combobox in a form. The box will show the values in column A.
The problem is somethies there is 65000 values/rows and sometimes only
1000.

Right now I have the range set as A5:A65000 but it makes the list quiet
empty for small datafiles.

Is there a way I can have the combobox only display values of filled
cells? The combobox is in a form so I dont know how to enter data other
than the peoperties in the editor ..

Matt

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Can Combobox range be variable?

another problem I have is that it selects data and times ... In the
list the values show up as dats and times but if you selct one it will
show as 38596.4767824074 until you click anywhere else. Then it turns
back into a data/time. Is there a way to prevent the 38596.4767824074
from showing at all?

Matt

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Can Combobox range be variable?

One way is to just format the list the way you want:

Option Explicit
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
Dim myRng As Range
Dim myCell As Range

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

With Me.ComboBox1
For Each myCell In myRng.Cells
.AddItem myCell.Text
'or
.AddItem Format(myCell.Value, "mm/dd/yyyy hh:mm:ss")
Next myCell
End With
End Sub


Matt wrote:

I have a combobox in a form. The box will show the values in column A.
The problem is somethies there is 65000 values/rows and sometimes only
1000.

Right now I have the range set as A5:A65000 but it makes the list quiet
empty for small datafiles.

Is there a way I can have the combobox only display values of filled
cells? The combobox is in a form so I dont know how to enter data other
than the peoperties in the editor ..

Matt


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can Combobox range be variable?

Can you use a validation (Tools: Validation: List) and then "ignore blanks"?

This would collapse the blanks but leave any non-blank values.


"Matt" wrote:

I have a combobox in a form. The box will show the values in column A.
The problem is somethies there is 65000 values/rows and sometimes only
1000.

Right now I have the range set as A5:A65000 but it makes the list quiet
empty for small datafiles.

Is there a way I can have the combobox only display values of filled
cells? The combobox is in a form so I dont know how to enter data other
than the peoperties in the editor ..

Matt


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 of input area in a combobox Kasper Excel Discussion (Misc queries) 1 July 24th 09 01:15 PM
Variable ComboBox on Userform DHallam Excel Programming 2 July 19th 05 12:20 PM
Filling combobox with variable length list Denny Behnfeldt Excel Programming 3 January 2nd 05 06:31 PM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM
Problem trying to us a range variable as an array variable TBA[_2_] Excel Programming 4 September 27th 03 02:56 PM


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