AW: Code
22.03.2005 10:30:57
bst
Morgen Andrea,
versuch mal sowas.
HTH, Bernd
--
Option Explicit
Sub Variationen()
Call doVar(10, 2)
End Sub
Sub doVar(maxSpalte As Integer, maxWert As Integer)
Dim i As Integer, zeile As Long
For i = 1 To maxSpalte - 1: Cells(1, i).Value = 0: Next i
Cells(1, maxSpalte) = -1
zeile = 1
While Inc(zeile, maxSpalte, maxWert)
If zeile Mod 100 = 0 Then Application.StatusBar = "Zeile: " & zeile
Range(Cells(zeile, 1), Cells(zeile, maxSpalte)).Copy Cells(zeile + 1, 1)
zeile = zeile + 1
Wend
Range(Cells(zeile, 1), Cells(zeile, maxSpalte)) = ""
Application.StatusBar = False
End Sub
Function Inc(zeile As Long, spalte As Integer, max As Integer) As Boolean
Inc = True
If Cells(zeile, spalte) < max Then
Cells(zeile, spalte) = Cells(zeile, spalte) + 1
ElseIf spalte > 1 Then
Cells(zeile, spalte) = 0
Inc = Inc(zeile, spalte - 1, max)
Else
Inc = False
End If
End Function