AW: Listbox- Problem
08.06.2005 15:28:33
Camel
Hi,
der Code steht in einer UserForm!
Private Sub ComboBox1_Change()
Dim MaxRows As Long
If ComboBox1.ListIndex = -1 Then Exit Sub
With Worksheets("Settings_Classic_Client").Columns(ComboBox1.ListIndex + 1)
MaxRows = .Cells.Find(What:="*", _
searchdirection:=xlPrevious, _
SearchOrder:=xlByRows).Row
Me.ListBox2.RowSource = .Rows("2:" & MaxRows).Address
End With
End Sub
Private Sub CommandButton1_Click()
Dim Value As Variant
If ListBox2.ListIndex = -1 Then Exit Sub
Value = InputBox("Value : ", "Change value", ListBox2.List(ListBox2.ListIndex))
If CBool(Len(Value)) Then
ListBox2.AddItem Value, ListBox2.ListIndex
End If
End Sub
Private Sub UserForm_Activate()
Dim Arr() As Variant
Dim Cell As Range
With Application.Worksheets("Settings_Classic_Client")
ComboBox1.Clear
For Each Cell In .Rows(1).Cells
If Not CBool(Len(Cell.Value)) Then Exit For
ReDim Preserve Arr(Cell.Column - 1)
Arr(Cell.Column - 1) = Cell.Value
Next
Me.ComboBox1.List = Arr
Me.ComboBox1.Value = Me.ComboBox1.List(0)
Erase Arr
End With
End Sub
ich bekomme Laufzeitfehler '70' Zugriff verweigert! Bei .Additem...
Aber ich weiss das ich Items ändern kann, aber ich hab im Augenblic ein Brett vorm Kopf!
Gruss
Camel