Hi,
I want to resort data in a matrix array into a string array. To do this I would like to use the sort function in eXcel, but I nee to repeat it for 29000+ lines. This is the macro that I have done to do it:
Sub Test()
'
' Test Macro
'
'
Range("B2:P2").Select
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("B2:P2"), _
SortOn:=xlSortOnCellColor, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("B2:P2")
.Header = xlGuess
.MatchCase = False
.Orientation = xlLeftToRight
.SortMethod = xlPinYin
.Apply
End With
End Sub
I am looking for a way to step this macro to the next line and repeat for the rest of the lines leaving the previous lines in their resorted order. The entire range would be B2:P29169.
I have attached an example of the spreadsheet. When you look at it, What I want to do is have all of the red cells sorted to the right, whilst keeping the data sorted in rows.
Thanks for the help,
Bookmarks