Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 06-22-2012, 08:44 AM
gbaker gbaker is offline Sorting Challenge Windows 7 32bit Sorting Challenge Office 2010 32bit
Competent Performer
Sorting Challenge
 
Join Date: May 2012
Posts: 111
gbaker is on a distinguished road
Default Sorting Challenge

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
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting by certain criteria randenius Excel 2 06-11-2012 02:18 AM
Sorting Challenge Word Challenge jpotter2 Word 3 03-22-2011 02:07 PM
Challenge!! Need help though. (Conditional formatting) knuckles70 Excel 2 02-05-2010 12:24 PM
Sorting Challenge CHALLENGE! Issue sorting data containing relative references on a separate tab 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

Other Forums: Access Forums

All times are GMT -7. The time now is 07:59 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft