AW: @Uwe - kleiner Bugfix und es ist perfekt ....
02.06.2014 11:58:46
UweD
Hallo
dann über ColorIndex...
Zelle markieren
über das kleine Makro wird dann die Farbe ausgelesen
Sub Farbe_lesen()
MsgBox "Index= " & Selection.Interior.ColorIndex
End Sub
Den Index dann hier entsprechend eintragen
Sub Farbe()
On Error GoTo Fehler
Dim TB1, TB2, SP%, ZE&, LR1&, LR2&
Dim i&, stCalc%
'*** bescheunigt das Makro
With Application
.ScreenUpdating = False
stCalc = .Calculation
.Calculation = xlCalculationManual
End With
'*** Stammdaten Anfang
Set TB1 = Sheets("Tabelle1")
Set TB2 = Sheets("Auswertung")
SP = 2 'Spalte B
ZE = 4 'ab Zeile
'*** Stammdaten Ende
LR1 = TB1.Cells(Rows.Count, SP).End(xlUp).Row 'letzte Zeile der Spalte
'*** Die eigentliche Routine
With TB1
TB2.Range("A:C").Clear
Range("A2").Formula = "Nummer"
Range("B2").Formula = "Info"
Range("C2").Formula = "Wichtig"
For i = ZE To LR1
If .Cells(i, SP).Interior.ColorIndex = 24 Or _
.Cells(i, SP).Interior.ColorIndex = 42 Or _
.Cells(i, SP).Interior.ColorIndex = -4142 Then ' Hellblau /Dunkelblau/ _
Keine
LR2 = TB2.Cells(Rows.Count, 1).End(xlUp).Row + 1
.Range("B" & i & ":C" & i).Copy TB2.Cells(LR2, 1)
.Range("F" & i).Copy TB2.Cells(LR2, 3)
End If
Next
End With
'*** Fehlerbehandlung
Err.Clear
Fehler:
If Err.Number 0 Then MsgBox "Fehler: " & Err.Number & vbLf & Err.Description: Err. _
_
Clear
'*** Rücksetzen
With Application
.ScreenUpdating = True
If .Calculation stCalc Then .Calculation = stCalc
End With
End Sub
Gruß UweD