Closed Thread
Results 1 to 3 of 3

Sorting and resorting data in excel macro

  1. #1
    Registered User
    Join Date
    02-12-2004
    Posts
    17

    Sorting and resorting data in excel macro

    I wrote the following macro to sort data in a column. Can anyone write the macro to copy the first 5% middle 5% and last 5% of my sorted data. I would much appreciate.

    Thanks,

    -----------------------------------------------------------
    Sub sort_1()

    Dim wkbook As Workbook
    Set wkbook = ActiveWorkbook

    Dim iRow As Integer

    iRow = wkbook.Sheets("Sheet1").Cells(Rows.Count, 1) _
    .End(xlUp).Offset(1, 0).Row

    wkbook.Worksheets("Sheet1").Activate
    wkbook.Sheets("Sheet1").Range("A3:A" & iRow - 1).Select

    Selection.sort Key1:=Range("A3"), Order1:=xlAscending, Header:=xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal

    End Sub
    --- Shakhawat
    =======================
    Md. Shakhawat Hossain Patwary
    Research Assistant
    Department of Civil Engineering
    Dalhousie University
    D304-1360, Barrington Street
    Halifax, Nova Scotia
    Canada B3J 2X4
    Talk: (902) 494 -3821

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Sorting and resorting data in excel macro

    Please edit your post to add code tags.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Sorting and resorting data in excel macro

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    Thread Closed.

Closed 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