AddItem
15.12.2005 04:16:57
Gnilk
heute habe ich mal wieder von nichts eine Ahnung.
Ich bin immer noch an meinen AddItems. Das Problem ist diesmal, dass ich mir das Updaten einfach machen will und daher eine Variable eingebaut habe. Es geht um die Zahl der UserForm.
Schaut Euch doch ma den Code an. Der Fehler tritt immer bei der Stele auf wo das AddItem kommt. Also es kann die Userform nicht gefunden werden.
Hierder Code:
Private Sub UserForm_Initialize()
' for the text in ComboBox1 "Description"
Dim letEin As Long, element As Long, Pump As String, nmbr As Long, wrt As WorksheetFunction
Pmp = "paul"
nmbr = 2
letEin = Worksheets("DB").Cells(65536, 2).End(xlUp).Row
With Worksheets("DB")
Worksheets("DB").Select
Selection.End(xlUp).End(xlToLeft).Select
For j = 2 To letEin
If Cells(j, 2).FormulaLocal = Pmp Then
wrt = ActiveWorkbook("UserForm" & nmbr)
wrt.ComboBox1.AddItem (Worksheets("DB").Cells(j, 4))
End If
Next
wrt = ActiveWorkbook("UserForm" & nmbr)
wrt.ComboBox1.AddItem (Worksheets("DB").Cells(2, 35))
End With
' for the text in the ComboBox4 "Qty"
For I = 2 To 100
wrt = ActiveWorkbook("UserForm" & nmbr)
wrt.ComboBox2.AddItem (Worksheets("DB").Cells(I, 34))
Next
' here you see the the value when you open the UserForm
UserForm1.ComboBox2.ListIndex = 0
End Sub
Vielen Dank im Voraus
Ciao
Gnilk