Leere Zeile einfügen per VBA
22.01.2008 08:16:23
christian
halo alle
ich habe ein macro aufgezeichnet das mir in jede 2zeile eine leerzeile einfügt. beginnen ab zeile 2
enden sollte es ca. bei zeile 200
wie kann ich das macro verkürzen?
DERZEITIGE AUFZEICHNUNG:
Sub jede2zeile()
Rows("2:2").Select
Selection.Insert Shift:=xlDown
Rows("4:4").Select
Selection.Insert Shift:=xlDown
Rows("6:6").Select
Selection.Insert Shift:=xlDown
Rows("8:8").Select
Selection.Insert Shift:=xlDown
Rows("10:10").Select
Selection.Insert Shift:=xlDown
Rows("12:12").Select
Selection.Insert Shift:=xlDown
Rows("14:14").Select
Selection.Insert Shift:=xlDown
Rows("16:16").Select
Selection.Insert Shift:=xlDown
ActiveWindow.SmallScroll Down:=9
Rows("18:18").Select
Selection.Insert Shift:=xlDown
Rows("20:20").Select
Selection.Insert Shift:=xlDown
Rows("22:22").Select
Selection.Insert Shift:=xlDown
Rows("24:24").Select
Selection.Insert Shift:=xlDown
ActiveWindow.SmallScroll Down:=6
Rows("26:26").Select
Selection.Insert Shift:=xlDown
Rows("28:28").Select
Selection.Insert Shift:=xlDown
Rows("30:30").Select
Selection.Insert Shift:=xlDown
Rows("32:32").Select
Selection.Insert Shift:=xlDown
ActiveWindow.SmallScroll Down:=9
Rows("34:34").Select
Selection.EntireRow.Hidden = False
Selection.Insert Shift:=xlDown
Rows("36:36").Select
Selection.Insert Shift:=xlDown
Rows("38:38").Select
Selection.Insert Shift:=xlDown
Rows("40:40").Select
Selection.Insert Shift:=xlDown
ActiveWindow.SmallScroll Down:=6
Rows("42:42").Select
Selection.Insert Shift:=xlDown
Rows("44:44").Select
Selection.Insert Shift:=xlDown
Rows("46:46").Select
Selection.Insert Shift:=xlDown
Rows("48:48").Select
Selection.Insert Shift:=xlDown
ActiveWindow.SmallScroll Down:=9
Rows("50:50").Select
Selection.Insert Shift:=xlDown
Rows("52:52").Select
Selection.Insert Shift:=xlDown
Rows("54:54").Select
Selection.Insert Shift:=xlDown
Rows("56:56").Select
Selection.Insert Shift:=xlDown
ActiveWindow.SmallScroll Down:=9
Rows("58:58").Select
Selection.Insert Shift:=xlDown
ActiveWindow.SmallScroll Down:=-75
Range("B1").Select
End Sub
BEISPIEL SO UNGEFÄHR KÖNNTE ES AUSSEHEN:
Sub leerzeilen_einfügen()
ab zeile 2 to 200 then
jede 2 zeile leerzeile einfügen
End Sub
danke
gruss
christian neu