+ Reply to Thread
Results 1 to 15 of 15

Searches all sheets in wb for exact string in column, copy/paste certain data from row

  1. #1
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Searches all sheets in wb for exact string in column, copy/paste certain data from row

    I have a macro (much thanks and kudos to arlu) that will search through a workbook and pull data from a certain column in each sheet. What I need now is to be able to pull other parts of the row that data is in onto that same sheet.
    Macro is:
    Please Login or Register  to view this content.
    I need to pull the person responsible, the Risk ranking L&S which are the highest for Personnel, and the highest for Environmental, and then the Item no. which corresponds to those rankings.

    I have attached a testbook which gives an example.

    Thank you very much to anyone who can assist me!
    Attached Files Attached Files
    Last edited by bcas77; 07-11-2013 at 01:36 PM.

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

    Re: Searches all sheets in wb for exact string in column, copy/paste certain data from row

    bcas77,

    Something like this?
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Re: Searches all sheets in wb for exact string in column, copy/paste certain data from row

    Oh wow! That's really close to what I'm looking for. Just one thing:

    Is it possible to pull what Item No. it is instead of the Section? I have it labeled incorrectly on the Recommendations page.

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

    Re: Searches all sheets in wb for exact string in column, copy/paste certain data from row

    Yeah, just change it from ws.Name to the same ws.Cells(rngfound.row, "column letter").text format of the others for the desired column letter.

  5. #5
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Re: Searches all sheets in wb for exact string in column, copy/paste certain data from row

    Also, there is special formatting on the R columns, is it possible to take that too?

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

    Re: Searches all sheets in wb for exact string in column, copy/paste certain data from row

    couodln't you just set up the same conditional formats on your 'Recommendations' sheet? There doesn't really need to be VBA for that...

  7. #7
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Re: Searches all sheets in wb for exact string in column, copy/paste certain data from row

    You're right, I was assuming the clear contents part of the code would take out the conditional formatting. Not sure why I thought that. Thank you again so much for your help!

  8. #8
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Re: Searches all sheets in wb for exact string in column, copy/paste certain data from row

    Hey I just was using the code and I'm getting an "Object variable or With block variable not set" from the Loop While line in the code from post #2. I tried it from a test workbook and it was working but I can't figure out what could be causing that error. Do you have any idea why I may get one of those?

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

    Re: Searches all sheets in wb for exact string in column, copy/paste certain data from row

    Can you post the code you're using? It's likely that you've adapted the code a bit, so I'd like to see exactly what the code is before I conjecture.

  10. #10
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Re: Searches all sheets in wb for exact string in column, copy/paste certain data from row

    Hey thanks for the quick reply! I've got a business trip next week and this code really saves me tons of time.

    Please Login or Register  to view this content.
    I don't think I changed it but it's obviously possible I did

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

    Re: Searches all sheets in wb for exact string in column, copy/paste certain data from row

    The code looks good to me. It might be a problem with merged cells. Are there any merged cells in column L of the other worksheets?

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

    Re: Searches all sheets in wb for exact string in column, copy/paste certain data from row

    Hmm... I tested it with some merged cells but that isn't causing the error for me. Can you post a sample workbook that is experiencing the problem?

  13. #13
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Re: Searches all sheets in wb for exact string in column, copy/paste certain data from row

    Tons of them. I'll run through and try and fix that. So there's no way I can have any merged cells and make that work?

  14. #14
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Re: Searches all sheets in wb for exact string in column, copy/paste certain data from row

    Yeah it was definitely the merged cells.

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

    Re: Searches all sheets in wb for exact string in column, copy/paste certain data from row

    Ok, I figured it might be, but I couldn't reproduce the error on my machine. Glad to hear you've got it sorted. As far as merged cells go, anybody who's worked with Excel a lot will always tell you to never use merged cells at all costs.

+ 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