+ Reply to Thread
Results 1 to 31 of 31

Extracting data - vlookups with closed Sheets

  1. #1
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Extracting data - vlookups with closed Sheets

    hi there,

    You very kindly helped me yesterday and I have seen a post today which is similar to what I need.

    I wonder if you might be able to help.

    The sheet you sorted for me yesterday needs to get its data from 2 other sheets which are closed.
    One is simply copying and pasting but the column order is different on open sheet and some columns are not to be copied. The 2nd closed sheet needs to have some data takens from via a Vlook up.

    So IF formula sheet is sheet I wan everything to go to.

    CAP listing is where the mojority of the data will come from but as I say it is a different order and with additional data I do not need on my IF sheet.

    MATS agreements is the other closed sheet which I will Vlookup the CAP (column D on my IF formula sheet) against whole sheet 1 in MATS aagreements and return the other data i.e. 1's and 0's.(although ideally I just want 1's to come across to save me deleting NA and 0 later.

    I am not sure how to attache sample files from here if you can let me know I will do this. I attempted to use a code you posted but I think I have adjusted it wrong.

    Many Thanks in advance
    Libby
    Attached Files Attached Files
    Last edited by Libster78; 03-05-2010 at 08:20 AM.

  2. #2
    Valued Forum Contributor JeanRage's Avatar
    Join Date
    03-02-2009
    Location
    Nice, France
    MS-Off Ver
    Excel 2003
    Posts
    705

    Re: Extracting data - vlookups with closed Sheets

    Hi,

    See below ... since topic is quite frequent ...

    http://www.excelforum.com/2257101-post4.html

    HTH

  3. #3
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Extracting data - vlookups with closed Sheets

    Thank you for that but I cannot find the link from your post.

    Libby

  4. #4
    Valued Forum Contributor JeanRage's Avatar
    Join Date
    03-02-2009
    Location
    Nice, France
    MS-Off Ver
    Excel 2003
    Posts
    705

    Re: Extracting data - vlookups with closed Sheets

    Hi,

    Below is the latest link ...
    http://xcell05.free.fr/english/index.html

    HTH

  5. #5
    Forum Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: Extracting data - vlookups with closed Sheets

    Hi Libby

    You may want to try the attached files, but firstly you will need to change the path of the MAT and CAP files within the code.

    Also for this to work you need to make sure that the headings in the two files are identical. I have made a note in the IF file regarding the column headers I had to change in the MAT and CAP files.

    Also the previous macro was based on there being information in the first column of IF Sheet1, but I have now changed this to be dependent on the CAP/Client No as I was unable to populate the Project Manager name.

    Please let me know how you get on.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Extracting data - vlookups with closed Sheets

    Morning,

    Thanks you very much.

    It is stopping at the bit in code that says
    Please Login or Register  to view this content.
    Also how do I add other columns to copy.

    I will need quite a few more but I presume I can simple add these.

    You are an absolute star by the way.

    Thanks
    Libby

  7. #7
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Extracting data - vlookups with closed Sheets

    Sorry my fault, wrong path name.

    Its not retrieving anything now. I think its me. I have changed the path and it is not debugging but it is not retrieving.

    Have I done something.

    Please Login or Register  to view this content.
    Libby

  8. #8
    Forum Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: Extracting data - vlookups with closed Sheets

    Morning Libby,

    You are welcome.

    It is probably stopping at that code because you need to change the following code

    Please Login or Register  to view this content.
    or copy the sample files to the C:\temp directory.

    Currently the code expects the CAP file to be in the C:\temp directory with filename CAP Sample.xls and the MAP file to be in the same directory with the sample filename.

    I don't know if you intend for the user to go and locate the CAP and MAT files themselves. If that is the case then you would probably want the code above to be


    Please Login or Register  to view this content.
    For the additional columns as long as the two files have the same column headings, you should be able to add as many as you need. At the moment, I think the only limitation is that the code relies on the IF file having more columns (with data) than the other two files. If it is likely that this would not always be the case, please let me know.

    Regards

  9. #9
    Forum Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: Extracting data - vlookups with closed Sheets

    Hi Libby

    I don't know why it didn't update, but I've amend the code to include your path.

    Are you using the sample files I sent back or your originals, as I had to change some of the headers of the sample files to match the headers in the IF file.

    In amending the code I have commented out the screen update codes till we resolve the problem you are currently having.
    Attached Files Attached Files
    Last edited by excelxx; 03-05-2010 at 05:44 AM.

  10. #10
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Extracting data - vlookups with closed Sheets

    Thats better if we can locate the file but its not retrieving anything.

    It did once then not again. I'm sure it is me.

    Libby

  11. #11
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Extracting data - vlookups with closed Sheets

    Let me see what I am doing as I think it because I have selected a file with wrong column headers.

    I'm so chuffed. Would have taken me ages as only new to VBA. Trying to learn.

    Thanks
    Libby

  12. #12
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Extracting data - vlookups with closed Sheets

    Sorry, I presume this will return things no matter how many rows there are?

  13. #13
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Extracting data - vlookups with closed Sheets

    Its me! I know it. It is asking me which file etc then it is opening but not retrieving. I checked the headings were the same but still not retrieving. Could it be because I am on Excel 2003?
    Libby

  14. #14
    Forum Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: Extracting data - vlookups with closed Sheets

    Hi Libby

    It will return data to the IF file, based on the number of rows on Sheet1 which have data in the CAP column (D).

    I used the CAP column as that column is common to the CAP and MAT files. I also had to use it in the determination of value in Sheet2 of the IF file, as I could not return a Project Manager name (Sheet1 column A), in the first bit of the code.

    It has just occured to me, that if you intend to add more columns you need to be aware that you would probably need to change the code which determines the columns for Sheet 2.

    I have attached the amended code with the file selection option for the CAP and MAT files
    Attached Files Attached Files
    Last edited by excelxx; 03-05-2010 at 05:54 AM. Reason: Forgot file

  15. #15
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Extracting data - vlookups with closed Sheets

    Is it based on some data already being in the CAP column?

  16. #16
    Forum Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: Extracting data - vlookups with closed Sheets

    That's odd, as it works with the sample files I have here. Also I'm working with Excel 2003, so that shouldn't be the problem.

    Are you still using the sample files or are you using your actual files at the moment, because if that is th case, you may need to amend the worksheets it refers to for the IF files.

  17. #17
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Extracting data - vlookups with closed Sheets

    Thats what it was. I deleted the CAP. Worked it out eventually.

    You are an absolute star.

    Thanks you so much.

    Libby

  18. #18
    Forum Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: Extracting data - vlookups with closed Sheets

    Yes it is based on there being data in the CAP column.

  19. #19
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Extracting data - vlookups with closed Sheets

    Hi there,

    Me again. Is there anyway it can be speeded up. I have 40, 000 rows and its crashing. i think to be fair its going to be that way because of the level of data but just thought I would check.

    Libby

  20. #20
    Forum Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: Extracting data - vlookups with closed Sheets

    Hi Libby

    I have made an amendment to the code, as I've done something similiar in other post.

    Hopefully the change should result in a better run time.

    Please try it and let me know how you get on.

    Regards
    Attached Files Attached Files

  21. #21
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Extracting data - vlookups with closed Sheets

    You star. Thank you very much.

    I am trying to learn but I don't seem to be doing very well.

    All your help is very much appreciated.

    Thanks agian

  22. #22
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Extracting data - vlookups with closed Sheets

    Hi there,

    Sorry for the delay. I have had a lot of problems. I have pasted the code into the word doc. I added 2 columns in with SLFF start period and SLFF end period in next to the project end date too.

    Hopefully you may be able to see what I have done.

    Thank you.

    Libby
    Attached Files Attached Files

  23. #23
    Forum Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: Extracting data - vlookups with closed Sheets

    Hi Libby

    One thing I did find was that you are using an older version of the code, so the data was being determined first then the columns were populated, as a result you had gone back to the situation we had earlier where you had to run the code three times before it had all the results you wanted.

    I have change the code and attached it to a separate file on its own with a command bar button. This means you now have to locate the IF file, like you do for the MATs and CAPs file.

    Please let me know if you have any problems.

    Regards
    Attached Files Attached Files

  24. #24
    Forum Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: Extracting data - vlookups with closed Sheets

    Hi Libby

    Please find attached the revised file with the errant link to the 'xla' file removed.

    Regards
    Attached Files Attached Files

  25. #25
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Extracting data - vlookups with closed Sheets

    Here's the screena shot for the error
    Thanks again
    Libby
    Attached Files Attached Files

  26. #26
    Forum Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: Extracting data - vlookups with closed Sheets

    Hi Libby

    I don't think I will be messing with add-ins for a while.

    I have now attached a newly created file, which reassigns the macro to the button on open. The new button is now just called Update.

    This should work now.

    Regards
    Attached Files Attached Files

  27. #27
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Extracting data - vlookups with closed Sheets

    Hi again.

    I'm so sorry I seem to keep messing up your code.

    I've simply added this to the blank sheet that I would use really it is only to show you the additions to the code.

    If I can get these additions in and it works that will be fab. It seems to be corrupting and not doing anything now.

    It did work though.
    Sorry
    Attached Files Attached Files

  28. #28
    Forum Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: Extracting data - vlookups with closed Sheets

    Hi Libby

    I think I have resolved all the anomalies. I have attached the file (IF master file) and the code file, these two work with the last CAP and MAT files.

    Please let me know how you get on.
    Attached Files Attached Files

  29. #29
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Extracting data - vlookups with closed Sheets

    Hi there,

    Its still not bringing across project renewal and the compliancy now.

    I had a version that worked perfectly and my computer corrupted it so maybe its me.

    Thank you so much

  30. #30
    Forum Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: Extracting data - vlookups with closed Sheets

    Hi Libby

    The code was working on the number of columns populated in the IF file which previously had more columns that either the MAT or CAP file, but this is no longer the case. So I've made an adjustment to pick up 20 more columns than the number of columns in the IF file.

    And the reason why the 'AW' column has no values is that is being determined based on values in column 'O' (Code closed for time) which has no values in it. I have amended this to look at column 'P' (commission) as I think that is most probable column which should be evaluated.

    I have amended the code for the columns which are not being picked up, but you would probably need to close down excel, so that you are sure you are using the current version.

    Please let me know if it works.

    Kind Regards
    Attached Files Attached Files

  31. #31
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Extracting data - vlookups with closed Sheets

    Thank you. I have got it to work. I think I had so many versions of this that you are right I think I had the wrong versions open.

    Thanks so much for all your help.

+ 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