robert konnte mir netterweise bei dieser Frage helfen:
https://www.herber.de/forum/archiv/1280to1284/t1282308.htm#1282308
Er konnte ein Makro erstellen, dass mir einen Zahlungsstrom anhand des Datums zusammenfassen kann. Es sieht so aus (Beispielmappe siehe o.g. Link):
Option Explicit
Sub tt()
Dim dstart As Date, estart As Date
Dim myrate As Long, datez As Long
Dim rngz As Long, x As Long, i As Long, zz As Long, nz As Long, endrate As Long
x = 2
zz = 2
rngz = 1
nz = 2
Application.ScreenUpdating = False
Range("E2:H1000").ClearContents
For i = nz To Cells(Rows.Count, 1).End(xlUp).Row
myrate = Cells(i, 3)
dstart = Cells(nz, 1)
If Cells(i + 1, 3) = Cells(i, 3) Then
endrate = endrate + myrate
rngz = rngz + 1
Else
Cells(zz, 5) = dstart
Cells(zz, 6) = Cells(i, 2)
Cells(zz, 7) = Cells(i, 3)
Cells(zz, 8) = rngz
zz = zz + 1
nz = i + 1
rngz = 1
End If
Next i
x = Cells(Rows.Count, 5).End(xlUp).Row
Cells(x + 2, 5) = Cells(2, 5)
Cells(x + 2, 6) = Cells(x, 6)
Cells(x + 2, 8) = Application.Sum(Range(Cells(2, 8), Cells(x, 8)))
Application.ScreenUpdating = True
End Sub
Nun möchte ich auch gerne den umgekehrten Weg, d.h. ich gebe eine Zusammenfassung vor und ein Makro soll mir den Zahlungsstrom erstellen. Die Laufzeiten varieren, d.h. die Zusammenfassung ist unterschiedlich lang (mal eine Zeile "von bis", mal x Zeilen).Ausgangslage/Eingabe:
von bis Rate Anzahl Monate
01.12.2012 31.12.2012 100,00 1
01.01.2013 30.04.2013 200,00 4
01.05.2013 30.09.2013 500,00 5
01.10.2013 28.02.2014 5.000,00 5
01.03.2014 31.10.2014 2.500,00 8
Gewünschtes Ergebnis :
von bis Rate
01.12.2012 31.12.2012 100,00
01.01.2013 31.01.2013 200,00
01.02.2013 28.02.2013 200,00
01.03.2013 31.03.2013 200,00
01.04.2013 30.04.2013 200,00
01.05.2013 31.05.2013 500,00
01.06.2013 30.06.2013 500,00
01.07.2013 31.07.2013 500,00
01.08.2013 31.08.2013 500,00
01.09.2013 30.09.2013 500,00
01.10.2013 31.10.2013 5.000,00
01.11.2013 30.11.2013 5.000,00
01.12.2013 31.12.2013 5.000,00
01.01.2014 31.01.2014 5.000,00
01.02.2014 28.02.2014 5.000,00
01.03.2014 31.03.2014 2.500,00
01.04.2014 30.04.2014 2.500,00
01.05.2014 31.05.2014 2.500,00
01.06.2014 30.06.2014 2.500,00
01.07.2014 31.07.2014 2.500,00
01.08.2014 31.08.2014 2.500,00
01.09.2014 30.09.2014 2.500,00
01.10.2014 31.10.2014 2.500,00
Wie baue ich das Makro von robert um, damit es das kann ?Grüße
Mexsalem