![]() |
|
#1
|
||||
|
||||
![]() Hi, Please can you attach your workbook to the thread? Maybe you've got merged cells or something on the worksheet? |
#2
|
|||
|
|||
![]()
Hi Colin,
I do have merged cells but they are above the area I want to sort. Workbook is very large. Let me try something first and then I'll send it to you if I can't figure it out. Thanks |
#3
|
|||
|
|||
![]()
I got rid of the merged cells and noticed that the freeze pane was also interferring with the sort. I am still getting another error called:
Runtime error '2147417848(800101108) Debug line is .Apply (text is highlighted in red below in the code. Code:
Sub SortDaysProvider() Dim DayRange As Long Dim TopRow As Long Dim sRange As Range Dim fRange As Range Application.ScreenUpdating = False For DayRange = 1 To 365 TopRow = (DayRange * 17) + 9 With ActiveWorkbook.Worksheets("Input Calendar (2012)") Set sRange = .Range("E" & TopRow & ":" & "BN" & TopRow + 14) Set fRange = .Range("E" & TopRow & ":" & "E" & TopRow + 14) With .Sort .SortFields.Add _ Key:=fRange, _ SortOn:=xlSortOnValues, _ Order:=xlAscending, _ DataOption:=xlSortNormal .SetRange sRange .Header = xlGuess .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply .SortFields.Clear End With End With Next DayRange Application.ScreenUpdating = True End Sub |
#4
|
||||
|
||||
![]()
That's an odd one. I used google and I found this thread. So, using the suggestion there:
Code:
With .Sort .SortFields.Add _ Key:=fRange, _ SortOn:=xlSortOnValues, _ Order:=xlAscending, _ DataOption:=xlSortNormal .SetRange sRange .Header = xlGuess .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin Application.Calculate .Apply .SortFields.Clear End With |
#5
|
|||
|
|||
![]()
Hi Colin,
I tried the new code a couple times and still get and error. Stops at: Code:
.SortFields.Add _ Key:=fRange, _ SortOn:=xlSortOnValues, _ Order:=xlAscending, _ DataOption:=xlSortNormal |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Joe Patrick | Word VBA | 2 | 01-30-2012 07:23 AM |
![]() |
Frankwlc | Word | 5 | 11-28-2011 01:54 AM |
![]() |
waldux | Word VBA | 1 | 03-04-2011 11:25 PM |
Runtime error 5487 - Word cannot complete the save to to file permission error | franferns | Word | 0 | 11-25-2009 05:35 AM |
Installing Access Runtime | ziggy0508 | Office | 1 | 09-29-2005 04:21 PM |