Gruppe
Allgemein
Problem
Wie kann ich Artikelnummern, die in einer Reihe von Arbeitsblättern mehrfach vorkommen, auf einem Deckblatt zusammenzählen?
StandardModule: basMain
Sub ArtikelnummernListen()
Dim rng As Range
Dim iCounter As Integer, iRow As Integer, _
iCol As Integer, iRowL As Integer
Cells.ClearContents
iCol = 2
For iCounter = 3 To Worksheets.Count
With Worksheets(iCounter)
Cells(1, iCol) = .Name
iRow = 1
Do Until IsEmpty(.Cells(iRow, 1))
Set rng = Columns(1).Find(.Cells(iRow, 1), _
lookat:=xlWhole, LookIn:=xlValues)
If rng Is Nothing Then
iRowL = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(iRowL, 1) = .Cells(iRow, 1)
Cells(iRowL, iCol) = 1
Else
rng.Offset(0, iCol - 1) = _
rng.Offset(0, iCol - 1) + 1
End If
iRow = iRow + 1
Loop
End With
iRow = 1
iCol = iCol + 1
Next iCounter
End Sub