Ich habe ein Excel-File mit einer Auflistung diverser Projekte, welche in weiteren Zellen noch zusätzliche Angaben haben wie Bereich, Kosten, Projektdauer etc.
Mittlerweile sind es in etwa 400 Projekte. Mein Vorgänger hat ein Makro geschrieben, mit welchem die ausgewählten Projekte in eine anschaubare Form gebracht werden.
Das Makro funktioniert soweit auch. Sobald ich aber mehr als 150 Projekte markiere schmiert Excel leider ab. Ich habe herausgefunden, dass das Problem darin besteht, dass das Makro für die Darstellung leere Zeilen einfügt und eine Rahmenlinie dazwischen setzt.
Hier mal das entsprechende Sub
Sub Zeilen_einfügen()
Sheets("Referenzliste").Select
Range("B5").Select
Do While ActiveCell Empty
If ActiveCell Empty Then
Do While ActiveCell Empty
Selection.EntireRow.Insert , CopyOrigin:=xlFormatFromLeftOrAbove
Selection.RowHeight = 4
Selection.EntireRow.Insert , CopyOrigin:=xlFormatFromLeftOrAbove
Selection.RowHeight = 4
ActiveCell.Offset(0, 5).Select
'Stoppmarke für ToRightRange setzen
ActiveCell = "E"
ActiveCell.Offset(0, -5).Select
'Haarlinie einfügen
Range(Selection, Selection.End(xlToRight)).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlHairline
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
ActiveCell.Select
'Zellverbindungen einfügen
Do While ActiveCell "E"
Range(Selection, Selection.End(xlUp)).Select
Selection.Merge
ActiveCell.Offset(0, 1).Select
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(0, -5).Select
ActiveCell.Offset(3, 0).Select
Loop
End If
ActiveCell.Offset(5, 0).Select
Loop
Ich weiss nicht genau wieso das selection.merge auch drin ist, aber das verursacht möglicherweise den Absturz.
für jegliche Hilfe bin ich sehr dankbar
Beste Grüsse
Corsin