Assuming the data values in Column "G" are all are constants (that is, there are no formulas in Column G), this macro should do what you want...
However, with the number of unique and data values being processed, I do not have a feel for how long it will take for this macro to execute.Code:Sub MarkPositionNumbers() Dim X As Long, LastUniqueRow As Long Const DataColumn As String = "G" Const UniqueColumn As String = "A" Const FirstUniqueRow As Long = 2 LastUniqueRow = Cells(Rows.Count, UniqueColumn).End(xlUp).Row On Error Resume Next Application.ScreenUpdating = False For X = FirstUniqueRow To LastUniqueRow With Columns(DataColumn) .Replace Cells(X, UniqueColumn).Value, "#N/A", xlWhole With .SpecialCells(xlConstants, xlErrors) .Offset(, 1).Value = X - FirstUniqueRow + 1 .Value = Cells(X, UniqueColumn).Value End With End With Next Application.ScreenUpdating = True End Sub
Note: You should look at the three Const statements and make sure the values I assign to them matches your actual setup.




Reply With Quote

Bookmarks