![]() |
#11
|
|||
|
|||
![]()
Hi Colin,
I finalized the code to work on 4 vendors. I am getting an error at the end. Compile Error: Expected End With Don't understand why I'm getting this error. Can you clarify. See code below. Code:
Sub SortdataOnly() With Sheet2 'get rid of any null strings stored in the cells for Print With .Range("Cr2:DE3980") .Value = .Value End With With .Sort 'set up the sort fields for Print on (data tab) With .SortFields .Clear .Add Key:=Sheet2.Range("Cr2:Cr3980"), _ SortOn:=xlSortOnValues, _ Order:=xlAscending, _ DataOption:=xlSortNormal .Add Key:=Sheet2.Range("Cs2:Cs3980"), _ SortOn:=xlSortOnValues, _ Order:=xlAscending, _ DataOption:=xlSortNormal End With 'set up the rest of the sort and apply for Print .SetRange Sheet2.Range("Cr2:De3980") .Header = xlNo .MatchCase = False .Orientation = xlSortColumns .SortMethod = xlPinYin .Apply End With With Sheet2 'get rid of any null strings stored in the cells for BNY With .Range("Dq2:Eb3980") .Value = .Value End With With .Sort 'set up the sort fields on BNY on (data tab) With .SortFields .Clear .Add Key:=Sheet2.Range("Dq2:Dq3980"), _ SortOn:=xlSortOnValues, _ Order:=xlAscending, _ DataOption:=xlSortNormal .Add Key:=Sheet2.Range("Dr2:Dr3980"), _ SortOn:=xlSortOnValues, _ Order:=xlAscending, _ DataOption:=xlSortNormal End With 'set up the rest of the sort and apply for BNY .SetRange Sheet2.Range("Dq2:Eb3980") .Header = xlNo .MatchCase = False .Orientation = xlSortColumns .SortMethod = xlPinYin .Apply End With With Sheet2 'get rid of any null strings stored in the cells for Wilde With .Range("En2:Ey3980") .Value = .Value End With With .Sort 'set up the sort fields on Wilde on (data tab) With .SortFields .Clear .Add Key:=Sheet2.Range("En2:En3980"), _ SortOn:=xlSortOnValues, _ Order:=xlAscending, _ DataOption:=xlSortNormal .Add Key:=Sheet2.Range("Eo2:Eo3980"), _ SortOn:=xlSortOnValues, _ Order:=xlAscending, _ DataOption:=xlSortNormal End With 'set up the rest of the sort and apply for Wilde .SetRange Sheet2.Range("En2:Ey3980") .Header = xlNo .MatchCase = False .Orientation = xlSortColumns .SortMethod = xlPinYin .Apply End With With Sheet2 'get rid of any null strings stored in the cells for DS Graphics With .Range("Fm2:Fx3980") .Value = .Value End With With .Sort 'set up the sort fields on DS Graphics on (data tab) With .SortFields .Clear .Add Key:=Sheet2.Range("Fm2:Fm3980"), _ SortOn:=xlSortOnValues, _ Order:=xlAscending, _ DataOption:=xlSortNormal .Add Key:=Sheet2.Range("Fn2:Fn3980"), _ SortOn:=xlSortOnValues, _ Order:=xlAscending, _ DataOption:=xlSortNormal End With 'set up the rest of the sort and apply for DS Graphics .SetRange Sheet2.Range("Fm2:Fx3980") .Header = xlNo .MatchCase = False .Orientation = xlSortColumns .SortMethod = xlPinYin .Apply End With End With End Sub |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sorting by certain criteria | randenius | Excel | 2 | 06-11-2012 02:18 AM |
![]() |
jpotter2 | Word | 3 | 03-22-2011 02:07 PM |
Challenge!! Need help though. (Conditional formatting) | knuckles70 | Excel | 2 | 02-05-2010 12:24 PM |
![]() |
lax828 | Excel | 3 | 01-07-2010 11:28 AM |
Challenge: Get Custom Form to Show up in Reader Pane in 2007 | JohnGG | Outlook | 0 | 08-21-2009 05:44 AM |