For example, below is one of the codes written in this forum by one of the Gurus.....can someone put a comment for me to explain each line of code in red. Thanks
Sub test()
Dim myAreas As Areas, myArea As Range, SL As Object, n As Long, i As Long
Application.ScreenUpdating = False
Set SL = CreateObject("System.Collections.SortedList")
Set myAreas = Columns(6).SpecialCells(2).Areas
n = myAreas(1).CurrentRegion.Row
For Each myArea In myAreas
With myArea.CurrentRegion
SL(Val(Split(.Cells(1).Value)(1))) = .Value
.ClearContents
.Borders.LineStyle = xlNone
End With
Next
For i = 0 To SL.Count - 1
With Cells(n, 1).Resize(UBound(SL.GetByIndex(i), 1), UBound(SL.GetByIndex(i), 2))
.Value = SL.GetByIndex(i)
With .Rows(3)
.Range("a1:e1").Borders(xlEdgeBottom).Weight = 2
.Range("f1:r1").Borders(xlEdgeBottom).LineStyle = xlDouble
End With
End With
n = n + UBound(SL.GetByIndex(i), 1) + 1
Next
Application.ScreenUpdating = True
End Sub
Bookmarks