ich lese eine UF-Listbox mit nachfolgendem Code ein.
Problem ist nur, wenn kein kein Eintrag vorhanden ist, bekomme ich eine Fehlermeldung
Laufzeitfehler 380, Cuolumneigenschaft kann nicht gesetzt werden.
Wie kann ich das umgehen?
Danke
Gruß, Ludmila
Sub KD_lst_Bank_Einlesen()
Dim bytBankSpalte As Byte
Dim bytBankSpalte1 As Byte
Dim ii as Integer
Dim iRowU As Integer
Dim arr()
Set WkbD = Workbooks(sData)
Set WksBank = WkbD.Worksheets(Bank)
frmKD.lstBank.Clear
With WksBank
bytBankSpalte = .Rows(1).Find(what:="DB_KD_BANK_NR", LookIn:=xlValues, lookat:= _
xlWhole).Column
For ii = 2 To .Cells(Rows.Count, 1).End(xlUp).Row
If Not IsEmpty(.Cells(ii, 1)) And .Cells(ii, bytBankSpalte) = frmKD.lblKDNr.Caption _
Then
ReDim Preserve arr(0 To 5, 0 To iRowU)
bytBankSpalte1 = .Rows(1).Find(what:="DB_KD_BANK_INHABER", LookIn:=xlValues, lookat: _
=xlWhole).Column
arr(0, iRowU) = .Cells(ii, bytBankSpalte1)
bytBankSpalte1 = .Rows(1).Find(what:="DB_KD_BANKNAME", LookIn:=xlValues, lookat:= _
xlWhole).Column
arr(1, iRowU) = .Cells(ii, bytBankSpalte1)
bytBankSpalte1 = .Rows(1).Find(what:="DB_KD_BANK_KOMPLETT_IBAN", LookIn:=xlValues, _
lookat:=xlWhole).Column
arr(2, iRowU) = .Cells(ii, bytBankSpalte1)
bytBankSpalte1 = .Rows(1).Find(what:="DB_KD_BANK_BIC", LookIn:=xlValues, lookat:= _
xlWhole).Column
arr(3, iRowU) = .Cells(ii, bytBankSpalte1)
bytBankSpalte1 = .Rows(1).Find(what:="DB_KD_ID_BANK", LookIn:=xlValues, lookat:= _
xlWhole).Column
arr(4, iRowU) = .Cells(ii, bytBankSpalte1)
arr(5, iRowU) = " "
iRowU = iRowU + 1
End If
Next ii
End With
With frmKD
.lstBank.ColumnWidths = 140 & ";" & 140 & ";" & 140 & ";" & 117 & ";" & 0
.lstBank.Column = arr
.lblBankDClick.Caption = "Doppelklick öffnet Bearbeitung - Gesamt:" & " " & .lstBank. _
ListCount
End With
1 End Sub