+ Reply to Thread
Results 1 to 7 of 7

Filter a list and return row to a summary sheet

  1. #1
    Forum Contributor
    Join Date
    05-01-2018
    Location
    Maine
    MS-Off Ver
    2010
    Posts
    114

    Filter a list and return row to a summary sheet

    Hello,

    We are having issues creating a fully working VBA code. I included an incomplete code in the attached example workbook but its not working. The goal is to select a name from a drop down list and have a code that will search another sheet for a match and transpose the text back to the "Summary" sheet. As long as the row is not "Completed" or "Cancelled" (we could not figure out how to include that in VBA). Here is the breakdown of the process we are needing:

    1. A name is selected in a drop down on G5 in the "Summary" tab
    2. Search for that name in the "Data" tab in column K
    3. If a match is found then check column Q to make sure its not "Completed" or "Cancelled" (If one of those apply then do not transpose that one row)
    4. If neither of those apply (even if its blank in Column Q) then transpose row text only- starting at C9 on "Summary"
    5. Then if Person2 is selected, wipe all data starting at C9 and repeat 1-4

    Please see the attached as it most likely will be easier to understand. Thank you in advance for any assistance with this. You all are heroes and very appreciated. I have learned so much from this site. Thank you.
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Filter a list and return row to a summary sheet

    Hi,

    Does the attached help

    It uses an Advanced Filter

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    05-01-2018
    Location
    Maine
    MS-Off Ver
    2010
    Posts
    114

    Re: Filter a list and return row to a summary sheet

    Thank you for the reply. I attempted the code in the actual workbook but it keeps returning "Run-time error '1004': Method 'Range' of object '_Worksheet' failed". I assumed the error was coming from those named ranges so I tried to match them 1 for 1 to what you had in the example workbook but that keeps popping up. Could it be something to do with the way that the headers are named? Some have / or # in the actual WB. I copied the headers so they would match but I just cannot seem to get it to work. The "Data" sheet is really a pretty intricate tab full of conditional formatting and such... so that tab will need to change.

    I attempted to include the headers from the actual WB into the Example one (you added code in) but it simply does not respond with any data. C9 and below just stay blank if I just change the headers to the ones we are actually using.

    Any ideas? Should I just scrap the code we were using?

    Thank you for the assistance with this. I very much appreciate it.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Filter a list and return row to a summary sheet

    Usually that error message is because the Field names in the Data are not the same as the field names in the DataOut range and/or the Crit range.

    Check by using an =MATCH(dataout_fieldname,firstrowofdatarange_fieldnames,False) and copy that across the whole dataout range of columns. Ditto check the Crit range field names exist in the first data row. You'll no doubt find a slightly different spelling, sometimes leading or trailing spaces are the culprit.

    However if you can't spot anything upload a copy of the workbook. We don't need the whole database just the first few rows will suffice.

  5. #5
    Forum Contributor
    Join Date
    05-01-2018
    Location
    Maine
    MS-Off Ver
    2010
    Posts
    114

    Re: Filter a list and return row to a summary sheet

    Sorry, I cant seem to figure it out. I tried to do everything from scratch again but this time it doesn't seem to to be returning anything at all. I attached a filtered version of the actual workbook.

    Question (I havent been able to use it yet), does this code also check column R for "Completed" or "Cancelled"? Honestly, I am not sure how to incorporate something like that into VBA. Obviously with a formula it would a If statement but im not sure how that looks in VBA. I havent used something like that as I usually just use a formula, but in this case I think it will need to be checked while the row is being matched.

    Thank you so much for the assistance. I am trying to learn how it all works but I am still stuck on piecing together different codes.
    Attached Files Attached Files
    Last edited by Darkcloud617; 07-14-2021 at 04:00 PM.

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Filter a list and return row to a summary sheet

    Ok, The mistakes are

    1. The range Data was defined as =OFFSET(My Appraisals!$A$1,0,0,COUNTA(My Appraisals!$A:$A),COUNTA(My Appraisals!$1:$1))

    it should be =OFFSET('My Appraisals'!$A$1,0,0,COUNTA('My Appraisals'!$A:$A),COUNTA('My Appraisals'!$1:$1))

    Note the all important single inverted comma at the start and end of 'My Appraisals'. Whenever there's a space in a sheet name these are vital. If the sheet name is a continuous string of characters it's not necessary but as good practice it's best to include them. WHen you create a dynamic range name like these by using the pointer to select the sheet and anchor cell you'll find the inverted commas get added. I guess you must have typed the whole string.

    2. The database field you're wanting is presumably column K with a field name of LO. Note that the BO2 criteria field name still says Rep Name. Change that to LO

    3. The word Completed was not included in the criteria range. And my mistake, the criteria are AND conditions and hence the criteria should be in the same row of the criteria range not in two rows.

    See attached
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    05-01-2018
    Location
    Maine
    MS-Off Ver
    2010
    Posts
    114

    Re: Filter a list and return row to a summary sheet

    Thank you so much for the help. I always forget that you can define sheet names by something like "Sheet1" as opposed to their name "Summary". Makes total sense in retrospect and seeing the difference you included in the code. I also think I could definitely benefit from understanding autofilters, that entire thing confuses me. Made note of all the above though.

    Thank you so much for the assistance. I am hoping one day soon I will be on the helping end of this forum as opposed to the question end. Have a great day and Thank You again.

+ 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. Advanced Filter from multiple sheets into Summary sheet
    By Wheelie686 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-05-2021, 05:45 PM
  2. [SOLVED] Advanced Filter from multiple sheets into Summary sheet
    By Wheelie686 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-04-2021, 06:30 PM
  3. [SOLVED] Extract and return a values in a summary sheet from various sheets.
    By Mohammad Munawar in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-17-2020, 11:53 AM
  4. How to compare to a list and return missing list items in summary. (if/and)
    By bigtunelover in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-07-2020, 02:06 AM
  5. [SOLVED] Filter single criteria across all worksheets and return values to a summary sheet
    By shreeja178 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-30-2014, 10:05 AM
  6. Copy two data sets, filter it and paste to summary sheet
    By pauldaddyadams in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-03-2012, 07:15 AM
  7. VBA Code to return a summary sheet of due actions
    By ambquinn in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-13-2011, 04:15 AM

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