mit nachfolgenden Code möchte ich die ComboBox einlesen.
Leider wird mir obwohl mehrere Zeilen die Bedingungen erfüllen nur die erste
Bedingung eingelesen.
Wo liegt der Fehler?
Danke, und nachträglich noch frohe Weihnacht!
Gruß
Ludmila
Option Explicit
Public Const Proj As String = "DB_Projekt"
Public wkb As Workbook
Sub Ang_Proj_Einlesen()
Dim ii As Integer
Dim iCol As Integer
Dim iCol1 As Integer
Dim iRow As Integer
Dim sTxtProj As String
frmStart.cboAngKdProjekt.Clear
With wkb.Worksheets(Proj)
iCol = .Rows(1).Find(what:="DB_PROJ_KD_KDNR", LookIn:=xlValues, lookat:=xlWhole).Column
iRow = .Columns(iCol).Find(what:=frmStart.lblAngKDNr.Caption, LookIn:=xlValues, _
lookat:=xlWhole).Row
iCol1 = .Rows(1).Find(what:="DB_PROJ_ANG_STAND", LookIn:=xlValues, lookat:=xlWhole). _
Column
For ii = 2 To .Cells(Rows.Count, 1).End(xlUp).Row
If .Cells(ii, iCol) = frmStart.lblAngKDNr.Caption Then
If .Cells(ii, iCol1) = "" Or .Cells(ii, iCol1) = "unbeauftragt" Then
frmStart.cboAngKdProjekt.AddItem
iCol = .Rows(1).Find(what:="DB_PROJ_ART", LookIn:=xlValues, lookat:=xlWhole).Column
sTxtProj = .Cells(ii, iCol).Value
iCol = .Rows(1).Find(what:="DB_PROJ_STRASSE", LookIn:=xlValues, lookat:=xlWhole). _
Column
iCol1 = .Rows(1).Find(what:="DB_PROJ_HNR", LookIn:=xlValues, lookat:=xlWhole). _
Column
sTxtProj = sTxtProj & " " & .Cells(ii, iCol).Value & " " & .Cells(ii, iCol1). _
Value
iCol = .Rows(1).Find(what:="DB_PROJ_PLZ", LookIn:=xlValues, lookat:=xlWhole).Column
iCol1 = .Rows(1).Find(what:="DB_PROJ_ORT", LookIn:=xlValues, lookat:=xlWhole). _
Column
sTxtProj = sTxtProj & " " & .Cells(ii, iCol).Value & " " & .Cells(ii, iCol1). _
Value
frmStart.cboAngKdProjekt.List(frmStart.cboAngKdProjekt.ListCount - 1, 0) = _
sTxtProj
iCol = .Rows(1).Find(what:="DB_PROJ_ID", LookIn:=xlValues, lookat:=xlWhole).Column
frmStart.cboAngKdProjekt.List(frmStart.cboAngKdProjekt.ListCount - 1, 1) = . _
Cells(ii, iCol)
End If
End If
Next ii
End With
End Sub