+ Reply to Thread
Results 1 to 4 of 4

macro to arrange rows in numerical order using numbers in column

  1. #1
    Registered User
    Join Date
    03-17-2013
    Location
    scotland
    MS-Off Ver
    Excel 2010
    Posts
    6

    macro to arrange rows in numerical order using numbers in column

    hi all
    back with a small issue
    does anyone know of a macro to automatically arrange the entire rows in my work sheet in order eg 1,2,3,4,5,6,7 etc
    using numbers entered in cells in column b
    many thanks
    blair

    ps i have an existing macro in thisworkbook hopefully the above macro wont interfear with

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,893

    Re: macro to arrange rows in numerical order using numbers in column

    The quickest way to do this, is to set the macro recorder to record. Go through the steps to sort on column B. Then look at the macro and clean it up as necessary. If after recording, you have any difficulties, post back with the code you have and the issues you are experiencing.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    03-17-2013
    Location
    scotland
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: macro to arrange rows in numerical order using numbers in column

    hi there
    the code i have is below
    how do i make it automatic ?
    thanks
    blair

    Sub Macro2()
    '
    ' Macro2 Macro
    '

    '
    Rows("54:65").Select
    Range("A65").Activate
    ActiveWorkbook.Worksheets("Complete").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Complete").Sort.SortFields.Add Key:=Range( _
    "B55:B65"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
    xlSortTextAsNumbers
    With ActiveWorkbook.Worksheets("Complete").Sort
    .SetRange Range("A54:AQ65")
    .Header = xlYes
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
    End With
    End Sub

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,893

    Re: macro to arrange rows in numerical order using numbers in column

    What do you mean by make it automatic?

+ Reply to Thread

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