Gruppe
Allgemein
Problem
Die Werte in den Spalten A und B sollen in Spalte C ausgeziffert werden.
StandardModule: basMain
Sub Ausziffern()
Dim iRowA As Integer, iRowB As Integer
Dim iRowLA As Integer, iRowLB As Integer
Dim iCounter As Integer
iRowLA = Cells(Rows.Count, 1).End(xlUp).Row
iRowLB = Cells(Rows.Count, 2).End(xlUp).Row
For iRowA = 1 To iRowLA
If Not IsEmpty(Cells(iRowA, 1)) Then
For iRowB = 1 To iRowLB
If Not IsEmpty(Cells(iRowB, 2)) Then
If Cells(iRowB, 2) = Cells(iRowA, 1) And _
IsEmpty(Cells(iRowB, 3)) Then
iCounter = iCounter + 1
Cells(iRowA, 3) = iCounter
Cells(iRowB, 3) = iCounter
Exit For
End If
End If
Next iRowB
End If
Next iRowA
End Sub