Results 1 to 8 of 8

Thread: Solved: Creating and Sorting a Dynamic Range

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    VBAX Regular
    Joined
    May 2013
    Posts
    34
    Location
    Quote Originally Posted by mancubus
    do you really need all range variables for a simple sorting?

    [VBA]Range("D40").CurrentRegion.Sort Key1:=Range("M40"), Order1:=xlAscending, Header:=xlGuess
    [/VBA]
    I'm hoping I don't have to use all those range variables hahahaha

    I didn't know about the 'CurrentRegion' property. However, I've tried to sue yours, but I get a "Sort method of range class failed" error.* I'm also a little uncertain how your "M40" key would grab the data downwards to the end of the column for sorting.

    *EDIT: I have a sort working now using 'CurrentRegion', with no errors. However, it grabs headers that are directly above and sorts through them (there are two rows of headers). Is there a way to keep it from looking upwards and pulling from above? I've circumvented the problem momentarily by placing the headers after sorting.

    Thank you so much!
    Last edited by Sock; 06-24-2013 at 01:44 PM.

Posting Permissions

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