Hab mal wie ein Problemchen:
Und zwar bäuchte ich nen Code, der eine ganze Zeile einfärb, wenn in A "München" steht.
Gibts da was?
Danke Alex
Sub zeileeinfärben()
Rows("1:26").Select 'anpassen
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=$A1=""Mücnhen"""
Selection.FormatConditions(1).Interior.ColorIndex = 40
End Sub
Sub FilternKopierenTGA()
Dim rngAct As Range
With Worksheets("TGA")
.Cells.Clear
Range("N1").AutoFilter _
Field:=14, Criteria1:="TGA" 'Filtern Spalte N nach TGA
Range("M1").AutoFilter _
Field:=15, Criteria1:="26000"
Range("A1:AS1300").Sort Key1:=Range("AH1"), Order1:=xlDescending, Header _
:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom _
, DataOption1:=xlSortNormal
Rows("1:26").Select 'anpassen
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=$A1=""München"""
Selection.FormatConditions(1).Interior.ColorIndex = 40
Set rngAct = Range("A1").CurrentRegion
rngAct.Columns(4).SpecialCells(xlCellTypeVisible).Copy .Range("A1")
rngAct.Columns(7).SpecialCells(xlCellTypeVisible).Copy .Range("B1")
rngAct.Columns(9).SpecialCells(xlCellTypeVisible).Copy .Range("C1")
rngAct.Columns(13).SpecialCells(xlCellTypeVisible).Copy .Range("D1")
rngAct.Columns(14).SpecialCells(xlCellTypeVisible).Copy .Range("E1")
rngAct.Columns(16).SpecialCells(xlCellTypeVisible).Copy .Range("F1")
rngAct.Columns(28).SpecialCells(xlCellTypeVisible).Copy .Range("G1")
rngAct.Columns(29).SpecialCells(xlCellTypeVisible).Copy .Range("H1")
rngAct.Columns(31).SpecialCells(xlCellTypeVisible).Copy .Range("I1")
rngAct.Columns(32).SpecialCells(xlCellTypeVisible).Copy .Range("J1")
rngAct.Columns(34).SpecialCells(xlCellTypeVisible).Copy .Range("K1")
rngAct.Columns(36).SpecialCells(xlCellTypeVisible).Copy .Range("L1")
Sheets("Tankdaten").ShowAllData
Sheets("TGA").Range("1:1").AutoFilter
End With
End Sub
Es kommt Laufzeit-fehlermeldung....