+ Reply to Thread
Results 1 to 11 of 11

How to data sort a sheet if header is on 2nd row? (beginner question)

  1. #1
    Registered User
    Join Date
    11-03-2006
    MS-Off Ver
    365
    Posts
    63

    How to data sort a sheet if header is on 2nd row? (beginner question)

    I would like to data sort a sheet which has a header starting on Row 2. Whenever I try doing this, I get an error that A2 and F2 are non-defined variables.

    Please Login or Register  to view this content.
    Is there something obvious I am overlooking?

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: How to data sort a sheet if header is on 2nd row? (beginner question)

    You have the wrong type of quotes they should be like " not the slanted type.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: How to data sort a sheet if header is on 2nd row? (beginner question)

    Ulnarian,

    Was Fluff right? I've gotta know.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    11-03-2006
    MS-Off Ver
    365
    Posts
    63

    Re: How to data sort a sheet if header is on 2nd row? (beginner question)

    Quote Originally Posted by Fluff13 View Post
    You have the wrong type of quotes they should be like " not the slanted type.
    OMG...

    Hah, you're a genius, thanks!

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: How to data sort a sheet if header is on 2nd row? (beginner question)

    You're welcome & thanks for the feedback

  6. #6
    Registered User
    Join Date
    11-03-2006
    MS-Off Ver
    365
    Posts
    63

    Re: How to data sort a sheet if header is on 2nd row? (beginner question)

    Ok, one more question.

    When I run the above script, it actually data sorts my header.

    That is, my header row (Row 2) ends up being data sorted to the bottom row. Does anyone know why this would happen?

    UPDATE:Err, nevermind, something else is going on; it actually seems to be replacing my header value with the value of a subsquent row and then data sorting that. This seems weird because the newly-replaced header row still has the same formatting applied to it (i.e. all the data is in bold); its just that the header text has been replaced...

    UPDATE 2: Ok, I fixed this, thanks all!
    Last edited by Ulnarian; 03-27-2020 at 11:26 AM.

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: How to data sort a sheet if header is on 2nd row? (beginner question)

    Do you have any data in row 1?

  8. #8
    Registered User
    Join Date
    11-03-2006
    MS-Off Ver
    365
    Posts
    63

    Re: How to data sort a sheet if header is on 2nd row? (beginner question)

    Quote Originally Posted by Fluff13 View Post
    Do you have any data in row 1?
    Yes; would that be an issue (it turns out my fix is no longer working...)

  9. #9
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: How to data sort a sheet if header is on 2nd row? (beginner question)

    Yes, because the current region will include row 1, which then becomes the header. Try
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    11-03-2006
    MS-Off Ver
    365
    Posts
    63

    Re: How to data sort a sheet if header is on 2nd row? (beginner question)

    Quote Originally Posted by Fluff13 View Post
    Yes, because the current region will include row 1, which then becomes the header. Try
    Please Login or Register  to view this content.

    Awesome!!!! Thanks!!!!

  11. #11
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: How to data sort a sheet if header is on 2nd row? (beginner question)

    You're welcome & thanks for the feedback

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Sort sheet based on header criteria
    By axtryo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-16-2017, 12:37 AM
  2. Adjusted question - Copy data to 2nd sheet based on criteria and sort
    By ALWETTA in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-02-2015, 10:55 AM
  3. [SOLVED] custom sort according to header in each sheet
    By raj soni in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 12-01-2014, 01:45 PM
  4. [SOLVED] Beginner Here: I need Macros to transfer specific data from one sheet to another sheet
    By aleem5 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-08-2013, 12:36 AM
  5. [SOLVED] Simple Beginner Question: Return Header from Max Value (More details in body)
    By gray-ish in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-06-2012, 07:58 PM
  6. Replies: 3
    Last Post: 11-20-2005, 12:35 PM
  7. [SOLVED] Beginner question about importing data from Access into Excel
    By travis in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-20-2005, 12:35 PM

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