Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

nicht ohne Selection möglich ???

Forumthread: nicht ohne Selection möglich ?

nicht ohne Selection möglich ?
17.01.2008 09:14:35
Franz
Guten Morgen Fachleute,
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

Anzeige

2
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: nicht ohne Selection möglich ?
17.01.2008 09:26:00
Beverly
Hi Franz,

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 .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
End With
End Sub




Anzeige
ach Mensch!!
17.01.2008 09:31:00
Franz
Hallo Karin,
ja klar, vielen Dank!!! Jetzt wo ich's seh, isses natürlich logisch, blöd von mir. Ich danke ganz herzlich!!
Grüße
Franz
;

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige