+ Reply to Thread
Results 1 to 6 of 6

How to execute a macro across a specific number of columns

  1. #1
    Registered User
    Join Date
    06-05-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    How to execute a macro across a specific number of columns

    Hello,

    I am trying to learn rules in altering a macro that has been recorded. I need the following code to execute across columns A-AX. Thank you in advance for your time.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: How to execute a macro across a specific number of columns

    Hi Lucasdylan,

    Try: Range("A2:AX21")
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    06-05-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: How to execute a macro across a specific number of columns

    Hello xladept:

    Thank you for the response. The change you suggested works, but I need the columns to be sorted independently. Right now it seems they are all being sorted on the numbers in column A. Any thoughts? Thanks again.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: How to execute a macro across a specific number of columns

    Hi lukasdylan,

    Maybe:

    Please Login or Register  to view this content.

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: How to execute a macro across a specific number of columns

    Hi lukasdylan,

    Get rid of that select at the end of the set - sorry.

  6. #6
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: How to execute a macro across a specific number of columns

    Alternate version, using Range.Sort instead of Worksheet.Sort:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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