Here is my attempt so far... but my brain hurts right now. There is one error saying "next without for statement" which makes no sense because I have that...
The other problem is its not actually getting the highest replay per each unique value, it keeps reseting it to 0.
The other HUGE problem, is this macro to run is going to loop 246924000000 times, which is just way to freaking slow, is there a way to make it so there are not these loops inside of loops or something?
Thanks
Sub Thing()
'Define Global Variables
BeginRow = 2
EndRow = 19000
Count = 1
UniqueCountMax = 648
'Loop For Each Unique Value
For UniqueValueLoop = Count To UniqueCountMax
'Select Highest Replay
With Worksheets("Unique Values")
refid = .Range("A" & Count)
End With
For RowCnt = BeginRow To EndRow
'Determine Highest Replay
If (ActiveWorkbook.Worksheets("Data").Cells(RowCnt, 22).Value = "1") And (ActiveWorkbook.Worksheets("Data").Cells(RowCnt, 18).Value = refid) Then
HighReplay = 1
End If
If (ActiveWorkbook.Worksheets("Data").Cells(RowCnt, 22).Value = "2") And (ActiveWorkbook.Worksheets("Data").Cells(RowCnt, 18).Value = refid) Then
HighReplay = 2
End If
If (ActiveWorkbook.Worksheets("Data").Cells(RowCnt, 22).Value = "3") And (ActiveWorkbook.Worksheets("Data").Cells(RowCnt, 18).Value = refid) Then
HighReplay = 3
End If
If (ActiveWorkbook.Worksheets("Data").Cells(RowCnt, 22).Value = "4") And (ActiveWorkbook.Worksheets("Data").Cells(RowCnt, 18).Value = refid) Then
HighReplay = 4
End If
If (ActiveWorkbook.Worksheets("Data").Cells(RowCnt, 22).Value = "5") And (ActiveWorkbook.Worksheets("Data").Cells(RowCnt, 18).Value = refid) Then
HighReplay = 5
End If
If (ActiveWorkbook.Worksheets("Data").Cells(RowCnt, 22).Value = "6") And (ActiveWorkbook.Worksheets("Data").Cells(RowCnt, 18).Value = refid) Then
HighReplay = 6
End If
If (ActiveWorkbook.Worksheets("Data").Cells(RowCnt, 22).Value = "7") And (ActiveWorkbook.Worksheets("Data").Cells(RowCnt, 18).Value = refid) Then
HighReplay = 7
End If
If (ActiveWorkbook.Worksheets("Data").Cells(RowCnt, 22).Value = "8") And (ActiveWorkbook.Worksheets("Data").Cells(RowCnt, 18).Value = refid) Then
HighReplay = 8
End If
'Print Highest Number For Each Unique Value
ActiveWorkbook.Worksheets("Unique Values").Cells(Count, 2) = HighReplay
'Delete Row For Each Unique Value if not highest replay
'For DeleteRow = BeginRow To EndRow
' If (ActiveWorkbook.Worksheets("Data").Cells(RowCntSecondary, 18).Value = refid) And (ActiveWorkbook.Worksheets("Data").Cells(RowCntSecondary, 22).Value <> HighReplay) Then
' Cells(RowCntSecondary, "A").EntireRow.Delete
' Next DeleteRow
Next RowCnt
Count = Count + 1
Next UniqueValueLoop
End Sub
Bookmarks