I need help making this code work.
Trying to sort in groups of 15 lines so that the information goes to the top of each group. See example in workbook attached.
This code is very important because it will complete this project.
Please Help.
Code:
Sub SortDaysProvider2()
Application.ScreenUpdating = False
For DayRange = 1 To 365
TopRow = (DayRange * 16) + 14
sRange = "B" & TopRow & ":" & "O" & TopRow + 15
fRange = "B" & TopRow & ":" & "B" & TopRow + 15
ActiveWorkbook.Worksheets("DATABNY").Sort.SortFields.Add Key:=
Range (fRange), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("DATABNY").Sort
.SetRange Range(sRange)
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Next DayRange
End Sub
I have attached a test sheet to show what I need it to do.
I really don't understand how this code works. Can you explain what TopRow = (DayRange * ) + does
I've tried a number of variations and it still doesn't work.
Thanks in Advance
GWB