Results 1 to 9 of 9

Sorting usedsheet with macro

Threaded View

  1. #1
    Registered User
    Join Date
    02-02-2005
    Posts
    11

    Sorting usedsheet with macro

    I am too new to excel vba to understand a lot of the code I see here which makes it very difficult to find what I need. I have a macro that when executed, sorts my sheet by cols a, b and c. I created it by using the recorder to sort those columns. The problem is that it comes bach with

    Range("A1:H345").Sort Key1:=Range("F2"), Order1:=xlAscending, Header:= _
            xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
            DataOption1:=xlSortNormal
    which works, but only until I add cols or lines. When I add cols, the range of the sort fails to include the new columns because of the hard coding of col/line numbers. I can't figure out the syntax of how to have it dynamically sort the sheet based on its current used area.

    Any help would be appreciated.

    Thanks.

    PS Is there a way to have this forum notify me when this thread is updated? I haven't been able to figure that out either. Until I figure that out, if you would copy [email protected] with your reply, it would be much appreciated.
    Last edited by clearwaterdave; 09-27-2007 at 10:28 AM. Reason: complete breakdown of communications with VBANOOB

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