Results 1 to 4 of 4

Tweaking of Macro Code to sort rows

Threaded View

swoosh Tweaking of Macro Code to... 06-22-2012, 01:31 PM
JapanDave Re: Tweaking of Macro Code to... 06-22-2012, 01:49 PM
swoosh Re: Tweaking of Macro Code to... 06-22-2012, 02:07 PM
swoosh Re: Tweaking of Macro Code to... 06-22-2012, 02:14 PM
  1. #1
    Registered User
    Join Date
    06-22-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    3

    Tweaking of Macro Code to sort rows

    I have some code for a macro that is designed to SORT multiple ROWS not columns. I have tweaked it a bit so that Column A would NOT be included in the sort of every row becuase it was a header row. However, I need only columns B through F sorted. Not Column G........I have got it to ignore column A, but how do I get it to ignore colum A and G?

    Here is the code:


    Sub sort()
    
    Dim iRow As Long
    Dim FirstRow As Long
    Dim LastRow As Long
    
    With Worksheets("sheet1")
    FirstRow = 2
    LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
    
    For iRow = FirstRow To LastRow
    With .Cells(iRow, "B").Resize(1, 6)
    .sort Key1:=.Columns(1), Order1:=xlAscending, _
    Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
    Orientation:=xlLeftToRight
    End With
    Next iRow
    End With
    End Sub
    Last edited by arlu1201; 06-22-2012 at 02:14 PM. Reason: Use code tags in future.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1