+ Reply to Thread
Results 1 to 11 of 11

Find first data row after header when data is filtered.

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Find first data row after header when data is filtered.

    hi,

    I have a macro which works as long as the data is NOT filtered. And i dont understand why it does not work when the data is filtered. I was hoping someone could help me understand and help me figure out a way to get macro to work regardless if data is being filtered.

    So here is the problem.
    (see enclosed file)

    The goal is to determine the first row of data "after the header row which is in row 1 in this case".
    Returns 2 if data is NOT filtered
    Returns 1 if data is filtered.

    Any ideas?
    Attached Files Attached Files

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Find first data row after header when data is filtered.

    So in this case, you want to select row 9 ?

    What is your exact requirement? What are you planning to do after selecting the 1st row below the header?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: Find first data row after header when data is filtered.

    in this file i want the value returned to be 2.......because this is the first data row below the header row which is in row 1.

    But when the filter is on it returns the value of 1.

    I use this to "check" what the "first data row" value is. The user is supposed to input the first data row but i want to check the file and determine what the first data row is......if the determined value (via vba) does not match the value input by the user then the program stops.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Find first data row after header when data is filtered.

    But the first data row is 9 right? How should it return 2?

    Do you mean you want the count of rows below the header?

  5. #5
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: Find first data row after header when data is filtered.

    ok, i did not explain this well i guess.

    What i am trying to do is determine the FIRST row which contains data AFTER the header row (which is row 1 in this file). In the file example i gave the first row of data After the header row is row 2...........not row 9. Row 9 shows up because the data has been filtered but the first row of data should be 2............

  6. #6
    Valued Forum Contributor
    Join Date
    11-15-2008
    Location
    ph
    MS-Off Ver
    2007/2010/2016
    Posts
    479

    Re: Find first data row after header when data is filtered.

    Hi -

    Why not just do a loop to test data from row 2 and beyond? Filter will work only for visible cells.

    Please Login or Register  to view this content.
    Regards,
    event

  7. #7
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: Find first data row after header when data is filtered.

    hi event21, i thought the "find" operation that i was doing in the vba was kinda what you suggested but just faster...........

  8. #8
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: Find first data row after header when data is filtered.

    i am showing the find operation that iwas talking about

    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor
    Join Date
    11-15-2008
    Location
    ph
    MS-Off Ver
    2007/2010/2016
    Posts
    479

    Re: Find first data row after header when data is filtered.

    Quote Originally Posted by welchs101 View Post
    hi event21, i thought the "find" operation that i was doing in the vba was kinda what you suggested but just faster...........
    for this purpose, it might not work.

    Not all scripts can be used in all instances, thats why majority here is asking for the sample data to easily understand the scenario.

    Regards,
    event

  10. #10
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: Find first data row after header when data is filtered.

    hi event21,

    i did provide sameple data and its on sheet1 of the file i enclosed.

    thanks again.

  11. #11
    Valued Forum Contributor
    Join Date
    11-15-2008
    Location
    ph
    MS-Off Ver
    2007/2010/2016
    Posts
    479

    Re: Find first data row after header when data is filtered.

    Hi -

    Did you try changing the codes from;
    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    Regards,
    event

+ 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