+ Reply to Thread
Results 1 to 16 of 16

find value,loop through 2 sheets and copy headers

  1. #1
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Unhappy find value,loop through 2 sheets and copy headers

    Hi guys,

    Ive got most of the code going, though cant seen to get the search results to show as I want them.

    I am putting in search items and running a macro to find the items on 'physical servers' WS, copying the header in that WS and the entire line the match appears on, though I cannot get it to do this.... it is really causing me stress

    Then next part that is working is the items that return false are showing up on the results page - this is expected and what i want it to continue to do.

    What I cant seem to work out also is how to run the search on the 'Virtual Server' WS also and return the results to the results WS as just like the 'physical servers' WS.

    I have included some dummy data + code + the expected result on the 'Server Results' WS.

    Hope you all can work out a way to make it work.

    thanks in advance guys
    Attached Files Attached Files
    Last edited by SarahPintal; 01-25-2010 at 12:50 AM. Reason: changed title

  2. #2
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Cant seem to get this code to work - over my head

    Am I overlooking something

    running a macro
    I don't see any code / macro in your Book1.xlsx (non macro enabled)
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  3. #3
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Re: Cant seem to get this code to work - over my head

    Oops... my bad, sorry X 10

    Ive attached the proper file.

    thanks
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Cant seem to get this code to work - over my head

    Can you describe what it should do.

    All these offsets, searches and such make my head spin.

    .. and what should this do?
    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Cant seem to get this code to work - over my head

    Sorry, I got it. Will take me a few minutes to remake the code.

    Hold your breath ....

  6. #6
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Cant seem to get this code to work - over my head

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

  7. #7
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Cant seem to get this code to work - over my head

    here's my code
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Re: find value,loop through 2 cheets and copy headers

    Thanks Rwgrietveld

  9. #9
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Re: find value,loop through 2 cheets and copy headers

    Hi, thanks for your efforts, it is about 90% exactly what I wanted.

    the only thing it doesnt not do is tell me which ones didnt have match...

    ie: i was expecting 'ExpectedNotToBeThere' to appear under a heading 'Found only in your input data'

    is that possible?

  10. #10
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: find value,loop through 2 cheets and copy headers

    For simplification add this code at the Bottom (between Next and End Sub)
    Please Login or Register  to view this content.
    The code can be resized enormously, but now the code is very readable as there are three logical steps.

    I would make an addition routine (Function) for the search that takes the SearchRange and the FindRange as an input.

    Maybe this is good exercise for yourself ...
    Last edited by rwgrietveld; 01-23-2010 at 08:01 AM.

  11. #11
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Re: find value,loop through 2 cheets and copy headers

    Thanks

    It works though it seems it is only looking into the rang3( and not range2 as well.

    Ive been trying to work out how to do this for the past 2 hours so i didnt have to ask, though ive failed

    can you assist one last time?

  12. #12
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Re: find value,loop through 2 sheets and copy headers

    hi guys,

    Can someone please help,

    I need the below code to be extended to also look in FindRng2 not much FindRng3.

    Please Login or Register  to view this content.

  13. #13
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: find value,loop through 2 sheets and copy headers

    t works though it seems it is only looking into the rang3( and not range2 as well.

    Ive been trying to work out how to do this for the past 2 hours so i didnt have to ask, though ive failed
    Why not copy the code again and change range2 into range3.

    Please Login or Register  to view this content.
    I know the code can be made more efficient, but not it is readable. I'll rework it tomorrow, so it's more compact. It's a sunday for me as well after all...

  14. #14
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Re: find value,loop through 2 sheets and copy headers

    Hi,

    Hope your having a good Sunday

    food for thought for tomorrow - the code you just gave checks range2 against the the inputted data and if not there write the line, then goes and checks range3 and does the same.

    This means that if there is a match in range2 and not in range3 (and vice versa) the line will still copy and make it look like its not in either range.

    It is is supposed to check both ranges and if it does not appear in either then write the line.

    hope i made it a lil clearer thanks in advance,

    have a nice sunday

  15. #15
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Re: find value,loop through 2 sheets and copy headers

    Hi all,

    This almost works though it will only finds and copies 1 of the"'NOT FOUND"

    in the attached workbook in there post there are 2 'NOT FOUND' when you click the button though it only copies the last. If it could find both then its completed.

    I think it just need a loop though ive been trying and cant get the result.
    Attached Files Attached Files

  16. #16
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    Re: find value,loop through 2 sheets and copy headers

    Worked it out - took a long time but did it.

    Please Login or Register  to view this content.

    I know it isnt hard code though I think im getting better thanks to everyones help on this forum. Your help and time is always very much appreciated

+ 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