+ Reply to Thread
Results 1 to 5 of 5

Find a column heading then sorting the sheet off that column

  1. #1
    Registered User
    Join Date
    02-28-2011
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    6

    Question Find a column heading then sorting the sheet off that column

    hi, my goal for this macro is to find the column heading "invoice number" then sorting the entire or most of the spreadsheet from said invoice number column. i've tried recording it but sometimes the report will have a different amount of columns and rows, so I'm trying to use a do while/if statement to find the column heading first before it sorts. however when I run it doesn't do anything.

    Please Login or Register  to view this content.
    EDIT: I th ink I'm not implementing the option compare text correctly as well.
    Last edited by Cluv; 04-01-2011 at 06:15 PM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Find a column heading then sorting the sheet off that column

    Please Login or Register  to view this content.
    Ben Van Johnson

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

    Re: Find a column heading then sorting the sheet off that column

    Mine's kinda long-winded, but I tested and know it works, so feel free to give it a try:

    Please Login or Register  to view this content.


    Hope that helps,
    ~tigeravatar

  4. #4
    Registered User
    Join Date
    02-28-2011
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Find a column heading then sorting the sheet off that column

    Quote Originally Posted by protonLeah View Post
    Please Login or Register  to view this content.
    I tried this and the error message says object doesn't support property or method. Let me try showing you the entire code.

    Please Login or Register  to view this content.

  5. #5
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Find a column heading then sorting the sheet off that column


    The line
    Please Login or Register  to view this content.
    was meant to replace the loop
    Please Login or Register  to view this content.
    When run it would return the range data for the column where it found the header.

    Then found.address(0,0) would give the address if the cell, say G1, or something, that would be used in the sort.

+ Reply to 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