wie kann ich dieses Makro umstricken, das alles was NICHT dem Text in Variable varValue entspricht, ersetzt wird?
With rngSpalte
.Replace varValue, "", xlWhole
.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With
vg,
Frank
On Error Resume Next
With rngSpalte
.SpecialCells(xlCellTypeConstants).Value = varValue
.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With
On Error GoTo 0
Sub tt()
Dim rngSpalte As Range, strVar As String
strVar = "Text2"
With Range("X1:X500")
.Formula = "=IF(COUNTIF(A1:A500,strvar)=0;"""";1)"
.Value = .Value
.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
.ClearContents
End With
End Sub
On Error Resume Next
With rngSpalte
.Offset(0, 1).Insert
.Offset(0, 1).FormulaR1C1 = "=IF(RC[-1]=""" & varValue & ""","""",FALSE())"
.Offset(0, 1).SpecialCells(xlCellTypeFormulas, xlLogical).EntireRow.Delete
.Offset(0, 1).EntireColumn.Delete
End With
On Error GoTo 0