+ Reply to Thread
Results 1 to 20 of 20

Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet name

  1. #1
    Registered User
    Join Date
    12-07-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    8

    Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet name

    Hello,

    I'm trying to record a macro that will search through sheets 2-8 to find the word "Attained" in column J. Once a cell is found with the word "Attained" I would like the entire row, columns A:I, to be copied and pasted onto sheet 1 beginning at row 3. It would be great if the sheet name that corresponds to the copy pasted data would post on sheet 1 in column J.

    Sheets 2-8 have data entered from row 3 down, and I am unsure how to get the macro to work appropriately. Is there a way to make it so the macro doesn't duplicate data already pulled from the other sheets to sheet one? I figured a macro would work better than a VLOOKUP or in-cell function, but if this is the better route to go I am definitely interested in anything to have this function appropriately.

    Thanks in advance for your help.

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet nam

    Can you attach an Excel file to help to prepare the macro.
    - Battle without fear gives no glory - Just try

  3. #3
    Registered User
    Join Date
    12-07-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet nam

    Hi PCI,

    Thank you for getting back to me. I've wiped out the macro and redid this several times, not sure what macro version is on the file, but it does not work. I've attached an example workbook file, please let me know if you have any questions.

    I really appreciate your assistance with this!
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet nam

    duplicate data already pulled
    It means that all values from column A to I are identical or is there only some cells to check ???
    Do we need to check duplicate with data already recorded in sheet Attained
    Last edited by PCI; 08-01-2018 at 05:55 PM.

  5. #5
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet nam

    Here a first step
    Please Login or Register  to view this content.
    Some comments:
    Code for duplicate will be added when duplicate question is clear
    Rows are not pasted to sheet ""Attained" but inserted because you have formulas at the bottom that we have to care
    BTW formulas ' range is curious, not starting from row 3
    It would be more confortable to put the last row at the top: More flexibility

  6. #6
    Registered User
    Join Date
    12-07-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet nam

    This works wonderfully! You're incredible! Thank you so much. It would be ideal if the data already recorded on sheet Attained does not duplicate. Is there a way to do that?

    I also like your idea of pasting the last row at the top. Curious, is this to support a chronological order?

  7. #7
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet nam

    the data already recorded on sheet Attained does not duplicate. Is there a way to do that?
    Yes of course, just give more details what is dupplicate ? is it when ALL cells are identical or does exist some key cells to rest

    is this to support a chronological order?
    I do not see what you mean ...this row is only a concern of formulas

  8. #8
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet nam

    There were a miss with the previous code when exist already some data in sheet Attained
    If you shift up the formula row keep in mind to attach the new file

    Please Login or Register  to view this content.

  9. #9
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,707

    Re: Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet nam

    Here is another way. No check for identical entries.
    Please Login or Register  to view this content.

  10. #10
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet nam


    Hi !

    Quote Originally Posted by jmemiller View Post
    It would be ideal if the data already recorded on sheet Attained does not duplicate.
    Attach at least a workbook with the expected result filled …

  11. #11
    Registered User
    Join Date
    12-07-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet nam

    Good morning! Sorry, I am in the US, so I go to bed kind of early and my schedule is much different compared to France. Nonetheless, thank you very much (everyone) for your assistance with this. I've attached the updated example workbook with the recent macro applied. Works perfectly.

    By duplicate, what I mean is on the Attained page, after running the macro, if we run the macro again it pulls in the same data it already derived from the sheets in the workbook. Its fine as is. I can always clear the Attained sheet and re-pull the info and sort/filter to find information. Thank you very much.
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet nam

    I can always clear the Attained sheet and re-pull the info
    If you want it , it is possible to include the Cleaning in the macro

    Option Explicit

    Please Login or Register  to view this content.
    Stil to point out the formula in the last row ... curious, the sum does not start at row 3

  13. #13
    Registered User
    Join Date
    12-07-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet nam

    Oh, yeah I know exactly what you are talking about regarding the sum not populating from row 3 down the page. I fixed that in a different version of the workbook. I noticed that when I scrolled down the Attained page and saw the sum started at like row 40 or something. Not sure what caused that, but I fixed it. Thank you for mentioning that, it was a mistake.

  14. #14
    Registered User
    Join Date
    12-07-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet nam

    Thank you for this new code, it has a strange bar that appears on the attained sheet when you run the macro. Not entirely sure what is causing that, but the revised version that I attached earlier is perfect. Thank you again! Please let me know if there is anything I can do to compensate you for your prompt and divine assistance.

  15. #15
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet nam

    Good, you are welcome
    Have a look on the star for rep...!

  16. #16
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet nam

    See here last adjustment following your last comment

    Please Login or Register  to view this content.
    and thank you for the rep

  17. #17
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,707

    Re: Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet nam

    @PCI
    Re: Post #16
    Need a restriction for data input not to go past row 44. Row 45 needs to stay empty.

  18. #18
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet nam

    @jolivanes
    Please Login or Register  to view this content.
    Not sure because the macro do not paste only but insert also. We could expect that at the beginning there is always some empty rows before the last 2 one and these empty row are kept.
    Insertion is also mendatory to keep the formulas updated while the formulas are not very clear
    Note : It was suggested to shift up these 2 rows in the header which makes more sense and wil lead to a code
    more simple
    Thank you for your comment, I have the feeling not be alone
    PCI

  19. #19
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,707

    Re: Search sheets for cell containing a word, copy paste row(s) to sheet 1, copy sheet nam

    Personally, I would prefer
    Please Login or Register  to view this content.
    or just
    Please Login or Register  to view this content.

  20. #20
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Try this !

    Quote Originally Posted by jmemiller View Post
    By duplicate, what I mean […]
    As a beginner starter :

    PHP Code: 
    Sub Demo1()
             
    Dim F&, Ws As WorksheetL&, S$
                 
    3
                 Application
    .ScreenUpdating False
        With Sheet1
               
    .UsedRange.Offset(2).Clear
            
    For Each Ws In Worksheets
              
    If Not Ws Is Sheet1 And Ws.Visible 0 Then
                With Ws
    .UsedRange.Rows
                    With 
    .Item("2:" & .Count)
                         .
    AutoFilter
                         
    .AutoFilter 10"Attained"
                         
    .Offset(1).Copy Sheet1.Cells(F1)
                         .
    AutoFilter 10
                    End With
                End With
                   L 
    = .Cells(1).End(xlDown).Row
                
    If >= F Then
                   
    .Range("J" ":J" L).Value Ws.Name
                    F 
    1
                End 
    If
              
    End If
            
    Next
            
    If 3 Then
                      S 
    "=SUM(R[" "]C:R[-1]C)"
                
    With .Cells(F7).Resize(, 3)
                     .
    Offset(-1).Copy .Cells
                     
    .Interior.ColorIndex 24
                     
    .FormulaR1C1 = Array(SS"=RC[-1]/RC[-2]")
                
    End With
            End 
    If
        
    End With
                 Application
    .ScreenUpdating True
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 08-03-2018 at 12:19 AM. Reason: optimization …

+ 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. Replies: 16
    Last Post: 08-09-2017, 12:50 PM
  2. Sheet to sheet Word String search for different cell copy
    By Rmccarver in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-09-2017, 10:01 AM
  3. Replies: 1
    Last Post: 03-14-2016, 09:26 PM
  4. Replies: 2
    Last Post: 04-29-2014, 10:06 AM
  5. [SOLVED] I need to search for a word on multiple sheets and copy the entire row to a new sheet
    By jkm750 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-26-2013, 12:13 AM
  6. Search word and copy line from multiple sheet to single sheet
    By drtorn in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-23-2012, 01:35 AM
  7. Replies: 2
    Last Post: 10-15-2009, 10:12 AM

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