markierten Bereich formatieren Code verbessern
12.09.2003 09:40:19
Lars Jungclaus
Vielen Dank
Sub FettZentrBereich()
Dim i, Ausgewählte_Zellanzahl, oberste_Zeile, linke_Spalte As Integer
Dim oben_links
On Error GoTo FeedBack
Ausgewählte_Zellanzahl = Selection.Areas.Count
ReDim Ausgewähltes_Feld(1 To Ausgewählte_Zellanzahl)
For i = 1 To Ausgewählte_Zellanzahl
Set Ausgewähltes_Feld(i) = Selection.Areas(i)
Next i
For i = 1 To Ausgewählte_Zellanzahl
oberste_Zeile = Ausgewähltes_Feld(i).Row
linke_Spalte = Ausgewähltes_Feld(i).Column
Next i
Set oben_links = Cells(oberste_Zeile, linke_Spalte)
For i = 1 To Ausgewählte_Zellanzahl
Selection.Font.Bold = True
Selection.HorizontalAlignment = xlCenter
Next i
Exit Sub
FeedBack:
If Err = 1005 Then
MsgBox ("Geht nicht in gesperrtem Blatt!")
Else
MsgBox Error(Err)
Resume Next
End If
End Sub