ich erstelle im Moment anhand einer Liste (Variabel) Tabellenblätter.
In diese Blätter trage ich Daten ein.
Aus diesen Tabellenblättern ziehe ich dann verschiedene Daten wieder heraus.
Dafür habe ich folgende Makros die mir die Formeln in ein Gesamtblatt eintragen.
Die ganze Geschichte ist allerdings ziemlich umfangreich geschrieben.
Nun meine Frage kann ich folgende Makros einfacher schreiben so das es auch
mit maximal 25 angelegten Blättern funktioniert.
Im Moment muss ich die Makros ja 25 mal schreiben.
****************************************************************************************************************
Sub trage_Daten_ein_1()
Sheets(3).Range("D5").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C16:R500C16)"
Sheets(3).Range("D6").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C17:R500C17)"
Sheets(3).Range("D7").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C18:R500C18)"
Sheets(3).Range("D8").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C19:R500C19)"
Sheets(3).Range("D9").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C20:R500C20)"
Sheets(3).Range("D10").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C21:R500C21)"
Sheets(3).Range("D11").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C22:R500C22)"
Sheets(3).Range("D12").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C23:R500C23)"
Sheets(3).Range("D13").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C24:R500C24)"
Sheets(3).Range("D14").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C25:R500C25)"
Sheets(3).Range("D15").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C26:R500C26)"
Sheets(3).Range("D16").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C27:R500C27)"
Sheets(3).Range("D17").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C28:R500C28)"
Sheets(3).Range("D18").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C29:R500C29)"
Sheets(3).Range("D19").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C30:R500C30)"
Sheets(3).Range("D20").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C31:R500C31)"
Sheets(3).Range("D21").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C32:R500C32)"
Sheets(3).Range("D22").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C33:R500C33)"
Sheets(3).Range("D23").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C34:R500C34)"
Sheets(3).Range("D24").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C35:R500C35)"
Sheets(3).Range("D25").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C36:R500C36)"
Sheets(3).Range("D26").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C37:R500C37)"
Sheets(3).Range("D27").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C38:R500C38)"
Sheets(3).Range("D28").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C39:R500C39)"
Sheets(3).Range("D29").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C40:R500C40)"
Sheets(3).Range("D30").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C41:R500C41)"
Sheets(3).Range("D31").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C42:R500C42)"
Sheets(3).Range("D32").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C43:R500C43)"
Sheets(3).Range("D33").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C44:R500C44)"
Sheets(3).Range("D34").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C45:R500C45)"
Sheets(3).Range("D35").FormulaR1C1 = "=SUM('" & Sheets(7).Name & "'!R4C46:R500C46)"
Application.CutCopyMode = False
Range("D5").Select
End Sub
****************************************************************************************************************
Sub trage_Daten_ein_2()
Sheets(3).Range("E5").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C16:R500C16)"
Sheets(3).Range("E6").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C17:R500C17)"
Sheets(3).Range("E7").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C18:R500C18)"
Sheets(3).Range("E8").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C19:R500C19)"
Sheets(3).Range("E9").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C20:R500C20)"
Sheets(3).Range("E10").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C21:R500C21)"
Sheets(3).Range("E11").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C22:R500C22)"
Sheets(3).Range("E12").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C23:R500C23)"
Sheets(3).Range("E13").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C24:R500C24)"
Sheets(3).Range("E14").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C25:R500C25)"
Sheets(3).Range("E15").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C26:R500C26)"
Sheets(3).Range("E16").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C27:R500C27)"
Sheets(3).Range("E17").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C28:R500C28)"
Sheets(3).Range("E18").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C29:R500C29)"
Sheets(3).Range("E19").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C30:R500C30)"
Sheets(3).Range("E20").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C31:R500C31)"
Sheets(3).Range("E21").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C32:R500C32)"
Sheets(3).Range("E22").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C33:R500C33)"
Sheets(3).Range("E23").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C34:R500C34)"
Sheets(3).Range("E24").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C35:R500C35)"
Sheets(3).Range("E25").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C36:R500C36)"
Sheets(3).Range("E26").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C37:R500C37)"
Sheets(3).Range("E27").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C38:R500C38)"
Sheets(3).Range("E28").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C39:R500C39)"
Sheets(3).Range("E29").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C40:R500C40)"
Sheets(3).Range("E30").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C41:R500C41)"
Sheets(3).Range("E31").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C42:R500C42)"
Sheets(3).Range("E32").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C43:R500C43)"
Sheets(3).Range("E33").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C44:R500C44)"
Sheets(3).Range("E34").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C45:R500C45)"
Sheets(3).Range("E35").FormulaR1C1 = "=SUM('" & Sheets(8).Name & "'!R4C46:R500C46)"
Application.CutCopyMode = False
Range("D5").Select
End Sub
****************************************************************************************************************
Ich hoffe es ist halbwegs klar rübergekommen.
Im voraus schon mal besten Dank.
Gruß
Gerold Dornbusch