nicht ohne Selection möglich ?
17.01.2008 09:14:35
Franz
ich versuche ganz brav, wie ich's hier gelernt habe :-))), wo immer möglich Select, Selection, Activate, ......... zu eliminieren. Jetzt stoß ich auf einen Fall, den ich nicht lösen kann.
So geschrieben (aufgezeichnet mit dem Rekorder) klappts:
Sub AlleMonateBlauWeg()
Application.ScreenUpdating = False
Range( _
"C3:F33,G3:J33,K3:N33,O3:R33,S3:V33,W3:Z33,C35:F65,G35:J65,K35:N65,O35:R65,S35:V65,W35: _
Z65" _
).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
End Sub
Ohne selection schaut der Anfang so aus:
Sub AlleMonateBlauWeg()
Application.ScreenUpdating = False
With Range( _
"C3:F33,G3:J33,K3:N33,O3:R33,S3:V33,W3:Z33,C35:F65,G35:J65,K35:N65,O35:R65,S35:V65,W35: _
Z65" _
)
.Borders(xlDiagonalDown).LineStyle = xlNone
.Borders(xlDiagonalUp).LineStyle = xlNone
'With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
'End With
'With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
End With
End Sub
Und hier kommt bei der Zeile:
.LineStyle = xlContinuous
... "Laufzeitfehler 438: Objekt unterstützt diese Eigenschaft oder Methode nicht."
Ich bitte Euch um Eure Hilfe.
Danke schonmal im Voraus und Grüße
Franz