First Question

  • Thread starter Thread starter Robert Couchman
  • Start date Start date
R

Robert Couchman

Hello,

here is the first question....

before i open up this form i would like the data for
combobox1 to look through spreadsheet in column "AX" and
display a list of any dates that appear in that column
(but only once if there is a date that appears more than
once)
then it will display the userform.

ANY HELP??

Thank you,

Robert Couchman
 
Robert,

Try something like the following code:

Dim Rng As Range
Dim V As Variant
Dim Coll As Collection
Set Coll = New Collection
Set Rng = Range("AX1")
On Error Resume Next
Do Until Rng.Value = ""
Coll.Add Rng.Text, Rng.Text
Set Rng = Rng(2, 1)
Loop
With UserForm1.ComboBox1
For Each V In Coll
.AddItem V
Next V
.ListIndex = 0
End With
UserForm1.Show


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Back
Top