ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   First Question (https://www.excelbanter.com/excel-programming/291739-first-question.html)

Robert Couchman[_4_]

First Question
 
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

Chip Pearson

First Question
 
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

"Robert Couchman" wrote in message
...
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





All times are GMT +1. The time now is 11:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com