Makro fortlaufend wiederholen
26.11.2015 10:07:21
Blue
ich habe mir mit Hilfe der Makroaufzeichnung ein Makro erstellt, welches mir aus Tabelle1 Daten in Tabelle2 in einer neuen Reihenfolge kopiert und die noch eine Formatierung anpasst.
Nun möchte ich das mir das Makro diesen Ablauf für die nächsten Zeilen wiederholt und zwar so oft wie in Tabelle1 gefüllte Zeilen gibt.
Könnte mir da jemand helfen?
Hier mal das Makro:
Sub Test()
' Test Makro
ActiveCell.FormulaR1C1 = "=Tabelle1!R[-16]C"
Range("C18").Select
ActiveCell.FormulaR1C1 = "=Tabelle1!R[-16]C"
Range("C19").Select
ActiveCell.FormulaR1C1 = "=Tabelle1!R[-17]C[1]"
Range("C20").Select
ActiveCell.FormulaR1C1 = "=Tabelle1!R[-18]C[2]&"" ""&Tabelle1!R[-18]C[3]"
Range("D18").Select
ActiveCell.FormulaR1C1 = "=Tabelle1!R[-16]C[3]"
Range("D19").Select
ActiveCell.FormulaR1C1 = "=Tabelle1!R[-17]C[4]"
Range("E18").Select
ActiveCell.FormulaR1C1 = "=Tabelle1!R[-16]C[4]"
Range("E19").Select
ActiveCell.FormulaR1C1 = "=Tabelle1!R[-17]C[5]"
Range("F18").Select
ActiveCell.FormulaR1C1 = "=Tabelle1!R[-16]C[5]"
Range("F19").Select
ActiveCell.FormulaR1C1 = "=Tabelle1!R[-17]C[6]"
Range("17:17,21:21").Select
Range("A21").Activate
Selection.RowHeight = 5
Range("B17:F21").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Range("B18").Select
End Sub
mfg Blue Bird