AW: Bedingte Formatierungen unter Excel 2007 :-/
11.02.2014 17:12:04
fcs
Hallo Michi,
die bedingten Formatierungen auszulesen ist nicht so einfach.
Hier mal ein Versuch zumindest die einfachen Varianten auszuwerten.
Gruß
Franz
Sub Bedingte_Formatierungen()
Dim intCount As Integer
Dim objBedFormat As Object 'FormatCondition
Dim strText As String
On Error GoTo Fehler
With ActiveSheet
For Each objBedFormat In .UsedRange.FormatConditions
intCount = intCount + 1
strText = intCount & ". Bedingungung"
strText = strText & vbLf & "Type: " & objBedFormat.Type
strText = strText & vbLf & "Zellbereich: " & objBedFormat.AppliesTo.Address
strText = strText & vbLf & "Formula1: " & objBedFormat.Formula1
If objBedFormat.Formula2 "" Then
Select Case objBedFormat.Operator
Case xlLess
strText = strText & vbLf & "Operator: " & "kleiner"
Case xlLessEqual
strText = strText & vbLf & "Operator: " & "kleiner gleich"
Case xlBetween
strText = strText & vbLf & "Operator: " & "zwischen"
Case xlNotBetween
strText = strText & vbLf & "Operator: " & "nicht zwischen"
Case xlEqual
strText = strText & vbLf & "Operator: " & "gleich"
Case xlGreater
strText = strText & vbLf & "Operator: " & "größer"
Case xlGreaterEqual
strText = strText & vbLf & "Operator: " & "größer gleich"
Case xlNotEqual
strText = strText & vbLf & "Operator: " & "nicht gleich"
Case Else
strText = strText & vbLf & "Operator: " & "unbekannt"
End Select
strText = strText & vbLf & "Formula1: " & objBedFormat.Formula2
End If
ShowMsgBox:
If MsgBox(strText, vbOKCancel, _
"Bedingte Formatierungen anzeigen") = vbCancel Then Exit For
Next
End With
Fehler:
With Err
Select Case .Number
Case 0 'alles OK
Case 1004
Resume ShowMsgBox
Case 13, 438
strText = strText & vbLf & "Diese Bedingte Formatierung konnte das Makro nicht _
verarbeiten"
Resume ShowMsgBox
Case Else
MsgBox "Fehler-Nr.: " & .Number & vbLf & .Description, , "Makro - _
Bedingte_Formatierungen"
End Select
End With
End Sub