Results 1 to 6 of 6

Repeat Macro on a series of lines. Help!!!

Threaded View

  1. #1
    Registered User
    Join Date
    01-20-2014
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    2

    Repeat Macro on a series of lines. Help!!!

    Hi,
    I want to resort data in a matrix array into a string array. To do this I would like to use the sort function in eXcel, but I nee to repeat it for 29000+ lines. This is the macro that I have done to do it:

    Sub Test()
    '
    ' Test Macro
    '
    
    '
        Range("B2:P2").Select
        ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
        ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("B2:P2"), _
            SortOn:=xlSortOnCellColor, Order:=xlAscending, DataOption:=xlSortNormal
        With ActiveWorkbook.Worksheets("Sheet1").Sort
            .SetRange Range("B2:P2")
            .Header = xlGuess
            .MatchCase = False
            .Orientation = xlLeftToRight
            .SortMethod = xlPinYin
            .Apply
        End With
    End Sub
    I am looking for a way to step this macro to the next line and repeat for the rest of the lines leaving the previous lines in their resorted order. The entire range would be B2:P29169.

    I have attached an example of the spreadsheet. When you look at it, What I want to do is have all of the red cells sorted to the right, whilst keeping the data sorted in rows.



    Thanks for the help,
    Attached Files Attached Files
    Last edited by alansidman; 01-21-2014 at 08:13 PM. Reason: code tags added

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to repeat the series of numbers
    By Latha Mani in forum Excel - New Users/Basics
    Replies: 10
    Last Post: 01-07-2014, 05:55 AM
  2. [SOLVED] Repeat lines get highlighted - how?
    By stawned in forum Excel General
    Replies: 14
    Last Post: 07-09-2012, 07:35 PM
  3. Repeat series
    By mets3145 in forum Excel General
    Replies: 0
    Last Post: 03-16-2008, 08:51 PM
  4. [SOLVED] Repeat series of formulas
    By GettingThere in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-13-2005, 02:05 PM
  5. Replies: 8
    Last Post: 01-22-2005, 08:06 PM

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