![]() |
#1
|
|||
|
|||
![]() 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 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 |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Will VBA code work in a web browser? | PeligrosoBlanco | PowerPoint | 1 | 03-28-2012 11:57 PM |
![]() |
user0044 | Project | 5 | 03-06-2012 07:28 AM |
![]() |
dukquaknoobhack | Office | 1 | 01-05-2012 03:43 PM |
![]() |
only300 | Office | 1 | 10-20-2011 02:52 AM |
simple code doesn't work help | piper7971 | PowerPoint | 2 | 08-19-2010 08:15 AM |