Im writing an excel macro, that essentially analyzes a range of information (one row specifically), and if there are triplicates (3 or more of the same name in a row), it sets the range to red so it stands out. Now what i want to do is every time the program finds a triplicate range, it saves that range (3 rows by 8 columns) to an array. I understand how to save a single range into an array, but how do i add the next range that my program finds (and then the next range, thereafter). After the program runs and finds all triplicate ranges, I want it to take that 2-d array and paste all of the found data into an empty sheet.
For k = 1 To LastRow - 1
' If (k + 1 <= LastRow) Then
If (FunctionArray(k + 1) = FunctionArray(k)) Then
count = count + 1
ElseIf (count >= 3 And FunctionArray(k + 1) <> FunctionArray(k)) Then
StartPoint = k - (count - 2)
Range(Cells(StartPoint, 1), Cells(k + 1, 11)).Select
With Selection
.Font.Bold = True
.Font.Color = -16776961
.Borders(xlEdgeLeft).LineStyle = xlContinuous
.Borders(xlEdgeRight).LineStyle = xlContinuous
.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeTop).LineStyle = xlContinuous
End With
count = 1
ElseIf (count = 2 And FunctionArray(k + 1) <> FunctionArray(k)) Then
count = 1
End If
Next k
If you look in the second IF statement, i already successfully wrote out the logic to find the desired range. i just need to save that information i find in a 2-d array and then continue to add the found ranges thereafter. Thank you for any help.