Rahmen (Linestyle Laufzeitfehler) wenn nur 1 Linie
Tanja
Ich habe ein Problem mit einem Rahmen.
Und zwar erscheint immer die Fehlermeldung "Die LineStyle-Eigenschaft des Border-Objektes kann nicht festgelegt werden". Wenn ich debugge wird die hier unten fett dargestellte Stelle markiert. Der Fehler liegt also bei den horizontalen Linien.
Diese Meldung erscheint nur wenn die Tabelle nur EINE Zeile besitzt. Sobald es 2 und mehr Zeilen sind funktioniert es tadellos.
Kann mir jemand einen Tipp geben wie ich das abfangen kann?
Hier noch der Code.
Dim lz%
lz = Cells(13, 1).End(xlDown).Row
With ThisWorkbook.Sheets(Sheet_Daten).Range(Cells(14, 1), Cells(lz, 8))
.Borders(xlEdgeLeft).LineStyle = xlContinuous
.Borders(xlEdgeLeft).Weight = xlThin
.Borders(xlEdgeLeft).ColorIndex = xlAutomatic
.Borders(xlEdgeTop).LineStyle = xlContinuous
.Borders(xlEdgeTop).Weight = xlThin
.Borders(xlEdgeTop).ColorIndex = xlAutomatic
.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeBottom).Weight = xlThin
.Borders(xlEdgeBottom).ColorIndex = xlAutomatic
.Borders(xlEdgeRight).LineStyle = xlContinuous
.Borders(xlEdgeRight).Weight = xlThin
.Borders(xlEdgeRight).ColorIndex = xlAutomatic
.Borders(xlInsideVertical).LineStyle = xlContinuous
.Borders(xlInsideVertical).Weight = xlThin
.Borders(xlInsideVertical).ColorIndex = xlAutomatic
.Borders(xlInsideHorizontal).LineStyle = xlContinuous
.Borders(xlInsideHorizontal).Weight = xlThin
.Borders(xlInsideHorizontal).ColorIndex = xlAutomatic
End with
Vielen Dank
Liebe Grüsse Tanja