PDA

View Full Version : Solved: Combobox



ProteanBeing
03-13-2008, 10:42 AM
I am trying to create a form with a combo box. The code is as follows:
Dim ComboData()
Private Sub UserForm_Initialize()
counter = 0
For Each MaterialNumber In ThisWorkbook.Worksheets("Log").Range("A3:A60000")
If Not IsEmpty(MaterialNumber.Value) Then
ReDim Preserve ComboData(3, counter)
ComboData(0, counter) = MaterialNumber.Value
ComboData(1, counter) = MaterialNumber.Range("B1").Value
ComboData(2, counter) = MaterialNumber.Row
counter = counter + 1
End If
Next MaterialNumber
Me.ComboMaterial.Column() = ComboData
End Sub

When I try to run it I get a msgbox that reads: "Invalid Property Value"
When I click OK the combo box is correctly filled in.
When I close the form I get the same msgbox again.
Does anyone know how to make this go away?

lucas
03-13-2008, 10:53 AM
Unless you want to post the workbook so we don't have to recreate it I would suggest strongly that you start all of your modules....userforms, etc with Option Exlplicit at the very top of the module. This will show you many of your errors.

Why are you putting this statement outside of the procedure?
Dim ComboData()

ProteanBeing
03-13-2008, 11:30 AM
I did all of that but still issues (I defined all of my variables)
Desperately need help

ProteanBeing
03-14-2008, 08:32 AM
bump

lucas
03-14-2008, 09:04 AM
post an example for us please. Most people will not recreate this just to try to figure it out. A simple example taken from your workbook showing the problem would help.