Ok, this one shouldn't be that hard.
I'm looking to go down column A, and find all of the doubled (or tripled, quad... ect) values. I originally would manually insert a cloumn, and write an "if" function to place an X if the cell R[-1]C[-1] was equal to the cell RC[-1]. I'd then run the macro to delete them. However, I want to have it all automated, so i'm trying to do that here in the top of the macro here.
(The if/then loop)
It doesn't work
. The erasing of rows that have X's works fine. It's just that I cant get the macro to place X's.
Sub Example()
Dim DeleteValue As String
Dim rng As Range
Dim calcmode As Long
With Application
calcmode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
Workbooks("Example").Worksheets("Sheet1").Columns(2).Insert
Do While IsEmpty(ActiveCell.Offset(0, -1)) = False
If ActiveCell.FormulaR3C2 = "(R[-1]C[-1])" Then
ActiveCell = "X"
End If
ActiveCell.Offset(1, 0).Select
Loop
DeleteValue = "X"
With ActiveSheet
.AutoFilterMode = False
.Range("B1:B" & .Rows.Count).AutoFilter Field:=1, Criteria1:=DeleteValue
With .AutoFilter.Range
On Error Resume Next
Set rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then rng.EntireRow.Delete
End With
.AutoFilterMode = False
End With
With Application
.ScreenUpdating = True
.Calculation = calcmode
End With
End Sub
Thanks,
`Ryan
Bookmarks