Results 1 to 1 of 1

I want to make a macro button that will sort on ranges that i have highlighted.

Threaded View

  1. #1
    Registered User
    Join Date
    08-28-2013
    Location
    44241
    MS-Off Ver
    Excel 2007
    Posts
    1

    I want to make a macro button that will sort on ranges that i have highlighted.

    Hello,

    I am trying to make a worksheet for people that aren't very familiar with Excel. I want to make a sort button that will sort only the areas that have been highlighted. There are multiple places where this worksheet will be sorted. I know that somehow I will have to change the range in my macro.


    Range("A2:N34").Select
        ActiveWorkbook.Worksheets("Material Sort").Sort.SortFields.Clear
        ActiveWorkbook.Worksheets("Material Sort").Sort.SortFields.Add Key:=Range( _
            "E2:E34"), SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:= _
            "BF.SM.01,BF.SM.02,BF.SM.03,BF.SM.04,BF.SM.05,BF.SM.06", DataOption:= _
            xlSortNormal
        With ActiveWorkbook.Worksheets("Material Sort").Sort
            .SetRange Range("A2:N34")
            .Header = xlGuess
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
        Range("H24").Select
    End Sub

    This is the macro now for an area I selected. Which range do I change to make it only highlighted areas.

    Thanks
    Attached Images Attached Images
    Last edited by arlu1201; 08-28-2013 at 01:15 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)

Similar Threads

  1. How do you make VBA perform a macro on EACH activecell highlighted?
    By kjy1989 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-16-2013, 02:14 AM
  2. [SOLVED] Macro to sort multiple ranges on a worksheet
    By Nikkishr in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-11-2012, 05:29 PM
  3. Make ranges in a sort macro change when I insert rows
    By Paul Sheppard in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-07-2012, 08:57 AM
  4. Make a button to run a macro
    By slmi1313 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-18-2008, 11:22 PM
  5. macro to make named ranges
    By Rosencrantz in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-06-2006, 10:00 AM

Tags for this Thread

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