AW: Formate übertragen
17.03.2012 12:31:10
Martin
Hallo!
Danke, diese grandiose Idee hatte ich auch schon, allerdings bekomme ich es nicht hin nur die Formate bis zu der letzten beschriebenen Zeile zu übertragen. Es werden bei diesem Makro nicht nur die Formate übertragen, sondern auch die Werte aus der 2. Zeile. Mhhhhh.
Ich hänge mal meinen Code an, könntest Du mir sagen was ich anpassen muss, damit nur die Formate ausgefüllt werden? "Bearbeiten, Ausfüllen, Formate" gibts leider nicht... sonst hätte ich es aufzeichen können.
Sub Makro5()
Range("A2").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$A2=$A1"
Selection.FormatConditions(1).Font.ColorIndex = 2
Range("B2").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$B2=$B1"
Selection.FormatConditions(1).Font.ColorIndex = 2
Range("F2").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=$F2=""Klaus"""
Selection.FormatConditions(1).Font.ColorIndex = 3
Range("G2").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$F2=""Peter"""
Selection.FormatConditions(1).Interior.ColorIndex = 35
Range("A2:G2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.FillDown
Range("A2").Select
End Sub
Gruß
Martin