View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mark Mark is offline
external usenet poster
 
Posts: 989
Default Populate Combo Box with Values from CSV File

I have a combo box that I want to use an array of values from the first
column of a CSV file.

Workingfilename = "master.csv"
workinglocation = workingdir & Workingfilename

If IsFileOpen(workinglocation) = True Then

MsgBox ("The file is in use, wait a moment and try again.")
Exit Sub

Else

Workbooks.Open (workinglocation)
On Error Resume Next
a = 1
cnt = 1

Do While Cells(a, 1) < ""
a = a + 1
cnt = cnt + 1
Loop


Dim myrange As Range

Dim myArray()
Erase myArray 'incase it's already full


myArray = Workbooks("Master.csv").Range(Cells(1, 1), Cells(cnt, 1)).Values

Workbooks("Master.csv").Close True

Getesc.EscDrop.List = myArray

Getesc.Show

End If
End Sub

Any idea why it keeps coming up blank??