+ Reply to Thread
Results 1 to 87 of 87

Opening a workbook from different location + Vlookup

  1. #1
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Opening a workbook from different location + Vlookup

    hello all,

    What I have :
    1. I have a workbook in Location "C:\Drawing Packages\"
    2. Name of the file is "A_.xlsx" .
    3. Active workbook open is "Trial_.xlsm"
    4. Attached are both files.


    What I want :
    1. on Trial.Sheet1.Range(B6:B10) i have some values.
    2. I want the VBA code to compare these values on Sheet1 of A_.xlsx Column B and find whats in the adjacent column
    3. Subsequently return to Trial_.xlsm and populate column C6:C10 with what it found on C6:C10 on A_.xlsx


    What I tried

    Please Login or Register  to view this content.

    Error I got
    • Object Required



    I am assuming the Array B6:B10 (5 rows) is not equal to what it is comparing (B:B) the entire B column) in A_.xlsx file

    Any help is much appreciated
    Attached Files Attached Files
    Last edited by subbby; 04-26-2017 at 07:25 AM. Reason: Solved

  2. #2
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    the underscore is something added just before I uploaded the files. Sorry for confusion if it causes one.

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Opening a workbook from different location + Vlookup

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Thanks for the response John. It is still giving same error. Run Time Error 424 : Object Required. It isn't pointing to any line in the code. Is there any way to find out which line is stopping from going ahead?


    I did close the "With" statement before I ran the code

    i tried doing F8 and goes upto the line
    "set wb2=Activeworkbook"

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Opening a workbook from different location + Vlookup

    My mistake try:

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Actually I had fixed that too.

    It was still the same error .Were u able to try it on any of the attachment excel files?

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Opening a workbook from different location + Vlookup

    Works for me on the attached files?

    Please Login or Register  to view this content.
    I missed an End With though.

  8. #8
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by JOHN H. DAVIS View Post
    Works for me on the attached files?

    .
    error.JPG

    attached is the error message I get
    Attached Images Attached Images

  9. #9
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    does having in a shared network drive create problems?

  10. #10
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by JOHN H. DAVIS View Post
    Works for me on the attached files?

    I missed an End With though.
    Hi John,

    I almost ... almost got it to running.. 1 problem....

    Please Login or Register  to view this content.
    Problem is (see screenshot below)
    • the first value and the last value gets the correct Lookedup answers... the others get messed up



    error2.JPG

  11. #11
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Opening a workbook from different location + Vlookup

    Try this.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  12. #12
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by bakerman2 View Post
    Try this.

    Worked well. Appreciate your time and effort.

    added a reputation star.

    Thanks again

  13. #13
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by bakerman2 View Post
    Try this.


    With book1.Sheets("Sheet1")
    sn = .Range("B6", .Range("B" & .Rows.Count).End(xlUp)).Resize(, 2)
    End With
    this part helped a lot... i am assuming it includes every cell with a value in column B into its range . I was eventually getting to this only !

    Thanks again

  14. #14
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Opening a workbook from different location + Vlookup

    You're welcome and thanks for rep+.

  15. #15
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    subbby

    This doesn't open A_.xlsm.
    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Welcome..

    just one question...

    What does this line do

    Please Login or Register  to view this content.


    Its matching what it found on Column B of book1 and comparing it with .Columns (2) . Little confused there.

    can you explain, if its not too much to ask

    In the program I am trying to use this , it looks from C29 instead of B6 . So I am working on modifying it slightly

    Thanks

  17. #17
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    See my post in #15

  18. #18
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by jindon View Post
    subbby

    This doesn't open A_.xlsm.
    Please Login or Register  to view this content.
    this too worked like a charm.. thanks Jindon...

    ...

    However, the actual place I am going to use this code will be comparing values in C29 onwards and not B6. I will attempt to change this code and see if that works

    Thanks again

  19. #19
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by jindon View Post
    See my post in #15
    this worked like a charm

    I sued the following code

    Please Login or Register  to view this content.
    U can see I have made some changes to the folder location ... and the file name and sheet name...

    Now it does ask for location to look for the comparing excel sheet. can we automate this ?

  20. #20
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    OK, I was to post the same...

  21. #21
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    While populating, it seems to clean the cell value. Is there away I can stop it ?

    I used the following code for checking the value in two different excel files.

    While i select the second one, it delestes all the values

    Please Login or Register  to view this content.

  22. #22
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    OK how do you want it?

    If cell matched to Drawing List_A.xlsm, skip that row for Drawing_Table_B?

  23. #23
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    See this screenshot. This is how I may have the numbers.

    If its number with "A" in it, it looks in Drawing List_A.xlsm and if it has "B" in the number, it must look in Drawing List_B.xlsm (a different excel sheet)

    When I tried the above code it did copy fill the details of numbers with "A" in them and when I showed where Drawing List_B.xlsm was, it deleted what it filled previously


    These new excel files are anew development as I had to make modifications somewhere else in a program that I have been using.



    Drawing_Table_A is a sheet in Drawing List_A.xlsm
    Drawing_Table_B is a sheet in Drawing List_B.xlsm

    database.JPG

  24. #24
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by jindon View Post
    OK how do you want it?

    If cell matched to Drawing List_A.xlsm, skip that row for Drawing_Table_B?


    and in addition to Post # 22

    I used this following code that works like a charm...... But

    problem arises when I move the values to C29 onwards instead of B6

    Please Login or Register  to view this content.

  25. #25
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    Do you mean like this?
    Please Login or Register  to view this content.

  26. #26
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by jindon View Post
    Do you mean like this?
    hello jindon.
    close enough but its asking to locate the source file for every row ..... is there a way to automate it ?

  27. #27
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    OOps
    Can you just delete the line of

    Please Login or Register  to view this content.
    I just put that line for the testing purpose...

  28. #28
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    i did remove it ... and it still is giving the same issue

  29. #29
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by jindon View Post
    OOps
    Can you just delete the line of

    Please Login or Register  to view this content.
    I just put that line for the testing purpose...
    worked worked worked.....

    my folder location was

    "Z:\Support\Engineering\Drawing Packages\Drawing Lists\"

    I changed that in ur code...

  30. #30
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    Then workbook name or sheet name might be wrong...

    It is working here.

    P.S
    OK, I just saw your last post.
    Attached Files Attached Files

  31. #31
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    I must appreciate everyone's patience here. John, Bakkerman and Jindon..

    thanks a lot all.

    Thanks to Jindon and Bakkerman for helping.

    Appreciate your patience Jindon. Its admirable.

  32. #32
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    You are welcome and thanks for the rep.

  33. #33
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    can i use this code on another excel sheet

    identical folder location, sheet name and filename ! no changes whatsoever... would it work ?

  34. #34
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    Yes, of course.
    Check all the cell reference in the formula and if they are all correct, it means no matched data found...

  35. #35
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    I tried it Jindon.

    its identical in the spreadsheet and it says Applications or Object not defined...

  36. #36
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by subbby View Post
    I tried it Jindon.

    its identical in the spreadsheet and it says Applications or Object not defined...
    It sometimes happens when the formula is not correct.

    Like the files I posted, it should work as it is, if the conditions are all the same.

  37. #37
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Ok thank you for your response.

    its still doesn't return any value

    See the screenshot below. It does get to the formula part , but doesn't copy the values .

    error4.JPG

  38. #38
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    I think it is a mapped network drive...
    Can you just try with unc? it should begin with \\

  39. #39
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    yes my Z drive is a network drive....

    Should I change

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.

  40. #40
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    And how did it go?

  41. #41
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    i did that and it kept asking for folder location for each row...

    it worked as if
    Please Login or Register  to view this content.
    was uncommented

  42. #42
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Also Jindon,

    the original file worked well with
    Please Login or Register  to view this content.
    it worked like a piece of cake .. see the screenshot below where the results came up
    error5.JPG

  43. #43
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    Yes, generally it should work...

    Does the workbook in question have same name as master workbook?

  44. #44
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    No Jindon, they are different

    See this screenshot below

    error6.JPG

  45. #45
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    however, their sheet names are different

    see screenshot below
    error7.JPG

  46. #46
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    If I remember () is the problem...

    Can you just try
    Please Login or Register  to view this content.

  47. #47
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by jindon View Post
    If I remember () is the problem...

    Can you just try
    Hello Jindon,

    where do I add that ? Do i just paste it ?

  48. #48
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    I did make it spit the formula by using the MsgBox... is that correct ?

    Drawing List_B is the filename and Drawing_Table_B is the worksheet name.... is that big box-bracket correct for filename ?



    error8.JPG

  49. #49
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    ??
    You have
    Please Login or Register  to view this content.
    But isn't it
    Please Login or Register  to view this content.
    ?

  50. #50
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    See Post # 25

    . I do have the code to read two more sheets and hence I added the ones in bold below

    Its same as how u instructed in Post # 25

    MasterFile_A = "Drawing List_A.xlsm"
    MasterFile_B = "Drawing List_B.xlsm"
    MasterFile_D = "Drawing List_D.xlsm"
    MasterFile_E = "Drawing List_E.xlsm"


    wsNameA = "Drawing_Table_A"
    wsNameB = "Drawing_Table_B"
    wsNameD = "Drawing_Table_D"
    wsNameE = "Drawing_Table_E"




    "Sheet2 (4)" is activeworkbook's active sheet name... similar to "Sheet1" in your zip files

  51. #51
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    OK, when the dialog box appears and you select the file, can you look at the formula in formula bar?

  52. #52
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by jindon View Post
    OK, when the dialog box appears and you select the file, can you look at the formula in formula bar?
    How do I check the formula ?

    this is what i got


    error9.JPG

  53. #53
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    If you just comment out
    Please Login or Register  to view this content.
    the formula should remain in the cell.

  54. #54
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by jindon View Post
    If you just comment out
    Please Login or Register  to view this content.
    the formula should remain in the cell.

    That didn't work either..


    I have attached the file herewith if that helps
    Attached Files Attached Files

  55. #55
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    Formula in D29

    =IFERROR(VLOOKUP($C$29,'C:\Users\Owner\Desktop\Drawing Lists\[Drawing List_B.xlsm]Drawing_Table_B'!B:C,2,FALSE),"")

    Is this correct?

  56. #56
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by jindon View Post
    Formula in D29

    =IFERROR(VLOOKUP($C$29,'C:\Users\Owner\Desktop\Drawing Lists\[Drawing List_B.xlsm]Drawing_Table_B'!B:C,2,FALSE),"")

    Is this correct?
    This is something you gave me Jindon... see post # 25

    But Drawing List_B.xlsm is a filename. Drawing_table_B is the sheet name in Drawing List_B.xlsm.

    so are those box placed correctly ? can you confirm ?

    As far is The latter part is concerned

    yes, its looking at the correct COLUMNS.

    as an example. It has to look in column B on worksheet = Drawing_table_B on Drawing List_B.xlsm and return its corresponding value from Column C onto the column D in Sheet1 (4) of active workbook
    Last edited by subbby; 04-27-2017 at 11:49 AM.

  57. #57
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by jindon View Post
    Formula in D29

    =IFERROR(VLOOKUP($C$29,'C:\Users\Owner\Desktop\Drawing Lists\[Drawing List_B.xlsm]Drawing_Table_B'!B:C,2,FALSE),"")

    Is this correct?
    Highlighted in red.. what does it stand for ?

    I am assuming it looks in Column B, returns the value from column C ?
    Not sure what does the number "2" and False do there

  58. #58
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    I need you to run the actual file with actual path(newrowk) that you are now using and want to see the actual formula in the cells, not mine.
    So that we can see the correct formula, if it is returning correct value.

    see VLookUp function
    https://support.office.com/en-us/art...8-93a18ad188a1

  59. #59
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    how do i see the formula ?

    The only way I can do is , by using Msgbox as I did in Post # 48

  60. #60
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    So I wrote
    Please Login or Register  to view this content.
    and got the one as shown in screenshot below

    and going by the explanation given on link https://support.office.com/en-us/art...8-93a18ad188a1 just above examples and comapring with the screenshot below
    • YES, the path is correct, the Workbook it is looking at = is correct,
    • The worksheet it is loot in the workbook = is correct
    • the column array is correct (B:B) ;
    • the column index is correct (the return value is in column C and its 2nd from Column B)




    error11.JPG

  61. #61
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    And I noticed one problem... I ran a F8 step by step.. Even thought Value at C29 is 114A5 (which is Like "*A*") it went to next look.... If you see the above screenshot , it is comparing C30 value for the second If statement where it looked for "*B*" .. actually value in C30 is 117A47

  62. #62
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    See another screenshot,

    its looking for C29 value inc condition for "*B*" which it is not supposed ... C29 value is 114A45..it should be seeing in Drawing List_A.xlsm filename and on Drawing_table_A sheeterror12.JPG

  63. #63
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    I even tried this

    Please Login or Register  to view this content.
    to force it to recognize the "A"... the code just doesn't go into that loop...

    Do you think an Object has to be set for the range or something like that.. asking layman questions as I am not well versed with Macros

    Pls advise

  64. #64
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    FOUND THE ERROR

    I must confess I am mad. I must apologize for wasting your time, Jindon. I am sincerely sorry.

    I had pasted the code in the wrong SHEET.. pasted in Sheet1 instead of Sheet1 (4) . See screenshot below


    Learned from my mistake

    Again.. thanks for your patience...the code worked well with no issues

    Appreciate it






    erro12.JPG

  65. #65
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    OK, glad that soled the issue.

  66. #66
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    jindon,

    the values this code will see are only numbers...

    example 4891, 103221, 78789

    The above code has to look at "Drawing List_SK.xlsm" 's "Drawing_Table_SK" worksheet when it sees a cell value with only NUMBERS... not alphanumeric

    Quote Originally Posted by jindon View Post
    subbby

    Try
    Please Login or Register  to view this content.
    Jindon,

    thanks for your code... This is the same code we were working on Drawing List _A and B....



    The following is the code I tried

    Please Login or Register  to view this content.

  67. #67
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    OK, can you post the code that you are running?

  68. #68
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by jindon View Post
    OK, can you post the code that you are running?
    this is the entire code..marked in RED is what and where I am stuck .
    Please Login or Register  to view this content.

    marked in BLUE is something that teh code doesnt recognize when it sees vales like P36E14, P5E14, P9E4..etc

  69. #69
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    I am even trying "ISNUMBER method


    Please Login or Register  to view this content.

  70. #70
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    This is tricky.. any idea why ?

    see screenshot below



    error13.JPG

  71. #71
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    Try
    1)
    Please Login or Register  to view this content.
    2)
    Please Login or Register  to view this content.

  72. #72
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by jindon View Post
    Try
    1)
    Please Login or Register  to view this content.
    2)
    Please Login or Register  to view this content.
    Doesn't work on SK and PE.. doesn't do anything

    Works only on A, B, D and E

  73. #73
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    Is the data copied from web or any other software?

  74. #74
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    no its from the Z drive only ... its an excel sheet on FilePath = "Z:\Support\Engineering\Drawing Packages\Drawing Lists\"

  75. #75
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    marked in BLUE is something that teh code doesnt recognize when it sees vales like P36E14, P5E14, P9E4..etc
    It should
    This should return True.
    Please Login or Register  to view this content.

  76. #76
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by jindon View Post
    Is the data copied from web or any other software?
    I re tried.. it works for SK now... but now P E

    let me show u a screenshot of what values of I see on my column C


    error14.JPG

  77. #77
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Error15.JPG


    This all checks out to be fine with


    error16.JPG

  78. #78
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    If you look at the file name, Isn't it
    Please Login or Register  to view this content.
    ?

  79. #79
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by jindon View Post
    If you look at the file name, Isn't it
    Please Login or Register  to view this content.
    ?
    Sorry.. I should have noticed that... I did fix it and still it didnt recognize

    Please Login or Register  to view this content.

  80. #80
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    I even tried this

    Please Login or Register  to view this content.
    Still doesn't do anything

  81. #81
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    And I ran the above as a separate code and it worked fine... it just isn't working when its in the big code

  82. #82
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    Then I need to see your workbook, not a picture.

  83. #83
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Jindon,

    thanks for your patience. I have solved this one. since it worked as a separate code. I called this in the main code.

    Separate code is

    Please Login or Register  to view this content.
    I called it in the main code by using the following

    Please Login or Register  to view this content.
    and all works fine. Workbook has been saved and I ran trial runs and all works fine...


    Thanks Jindon... appreciate it

  84. #84
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    So you got it to work finally, that's a good news.

  85. #85
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by jindon View Post
    So you got it to work finally, that's a good news.
    Yes Sir. Thanks to you and your patience.

  86. #86
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Opening a workbook from different location + Vlookup

    Last thing that I should tell you is that when square brackets, [ ] or apostrophe, ' used in file path or book name, it should be escaped by a double quote.

    So better not use them to avoid too much hustle... just for your information.

  87. #87
    Forum Contributor
    Join Date
    08-24-2012
    Location
    Hollidaysburg, Pa
    MS-Off Ver
    Excel 2010
    Posts
    398

    Re: Opening a workbook from different location + Vlookup

    Quote Originally Posted by jindon View Post
    Last thing that I should tell you is that when square brackets, [ ] or apostrophe, ' used in file path or book name, it should be escaped by a double quote.

    So better not use them to avoid too much hustle... just for your information.
    Yes, I agree. I will surely keep that in mind and your code in this thread is like a dictionary for me. I am going to be referring this for a lot many examples . Learnt a big deal ... calling a file in a different folder using those brackets and apostrophe's ...

    Thanks again Jindon

+ 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. Macro to automatically add the workbook to trusted location upon opening
    By king05 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-02-2017, 08:30 AM
  2. Opening files from last location
    By MrsPeacock in forum Excel General
    Replies: 2
    Last Post: 07-28-2015, 07:30 AM
  3. [SOLVED] Specify export pdf file location is location workbook is saved.
    By dantray02 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-30-2014, 01:13 PM
  4. Opening Excel from shared location
    By bkjain in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-21-2010, 08:37 AM
  5. opening a file from a remote location
    By Josh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-21-2006, 05:10 PM
  6. Replies: 7
    Last Post: 04-01-2005, 12:06 PM
  7. Replies: 1
    Last Post: 02-26-2005, 02:06 PM

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