+ Reply to Thread
Results 1 to 19 of 19

Search & copy data from any of 100 columns in closed WorkBook without opening it

  1. #1
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Red face Search & copy data from any of 100 columns in closed WorkBook without opening it

    Hi everyone,

    I urgently need a kickstart with VBA code.

    With value from a cell in Active Sheet, Search & Copy data from any of 100 columns in closed WorkBook without opening it, and then paste it to nth row of Column x in Active Sheet.

    Any help will be greatly appreciated!!
    Last edited by Winon; 12-13-2011 at 08:27 AM.

  2. #2
    Valued Forum Contributor Miraun's Avatar
    Join Date
    04-03-2009
    Location
    New England
    MS-Off Ver
    2003, 2007, 2010, 2013
    Posts
    554

    Re: Search & copy data from any of 100 columns in closed WorkBook without opening it

    You need to install additional addons in order to be able to copy out of closed workbooks. That function is not available natively.
    Going for Guru! Click the Star to the bottom left of this post if I helped!

  3. #3
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Search & copy data from any of 100 columns in closed WorkBook without opening it

    Hi Miraun,

    I don't agree totally. I do have code that extracts data from a fixed range in a closed book, in seconds. The problem that I am stuck with now is, that I need code to search for a column in a closed workbook and exract the info from that column.

    There are BRILLIANT Gurus on this Forum, who will show us how it can be done!

  4. #4
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Search & copy data from any of 100 columns in closed WorkBook without opening it

    Surely there must be someone, somewhere who has either an answer or link they can suggest?

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Search & copy data from any of 100 columns in closed WorkBook without opening it

    search for surname in column header
    in A1

    PHP Code: 
    =INDEX('E:\OF\[addresses 002.xls]Sheet1'!$A:$AE,ROW(),MATCH("surname",'E:\OF\[addresses 002.xls]Sheet1'!$A$1:$AE$1,0)) 
    Last edited by snb; 12-13-2011 at 05:45 AM.



  6. #6
    Forum Contributor wamp's Avatar
    Join Date
    11-10-2008
    Location
    Norway
    MS-Off Ver
    97, 2000 & 2003 (diff. workstations)
    Posts
    184

    Re: Search & copy data from any of 100 columns in closed WorkBook without opening it

    This should give you a start:

    See following example-workbooks:

    closedWBImport Imports values from test.xls;Sheet1;range A1:I11.
    closedWBImport.xls

    (note: "test.xls" just contains sample-data so you can see that it works; place it in C:\test\test.xls; or change the values in Sheet1; range B1:B3.
    test.xls
    _______________________________________________
    Remember:

    Read the rules!

    Use code tags! Place [CODE] before the first line of code and [/CODE] after the last line of code.

    Mark your post [SOLVED] if it has been answered satisfactorily.
    To do this, click EDIT in your original post, click GO ADVANCED and set the PREFIX. It helps everybody!

    If you are approve (or disapprove) of any members response to your problem, please click the star icon underneath their post and comment. It matters.

  7. #7
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Search & copy data from any of 100 columns in closed WorkBook without opening it

    @wamp

    The method you use isn't a VBA method but the same 'link formula' approach I suggested.

  8. #8
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Search & copy data from any of 100 columns in closed WorkBook without opening it

    Good Morning snb,

    Thank you for your Formula, but it returns an error:

    Please Login or Register  to view this content.
    Which I have changed to:

    Please Login or Register  to view this content.
    It retuns a #REF!

    What am I doing wrong?

  9. #9
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Search & copy data from any of 100 columns in closed WorkBook without opening it

    Hello Wamp,

    Thank you for your reply,

    I am already using similar formulas to retrieve static info. The problem that I am stuck with now is, that I need code to search for a column based on any of 150 values in a closed workbook and extract the info from that column.

    snb seems to be onto something which I like. Just need to maybe polish it a bit!

  10. #10
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Search & copy data from any of 100 columns in closed WorkBook without opening it

    slight modifications:

    Please Login or Register  to view this content.
    Try this new formula.

    The formula is 'relative' because of the use of ROW(). so it returns the row of the cell that contains the formula.
    You could test this formula to get row 10 in the found column:
    Please Login or Register  to view this content.

    Because I'm unaware of the value in cell BF9, it's possible no match has been found. In that case the formula fails.
    Last edited by snb; 12-13-2011 at 06:37 AM.

  11. #11
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Search & copy data from any of 100 columns in closed WorkBook without opening it

    Thank You snb,

    Actually both the Row(), or row number i.e "9" works, but I found a strange twist.

    The values in row9 are Transposed from a Column and the ROW() function fails that test when it searches row9 for the value specified. Why? I don't know. Replace ROW() with the actual row number, and it works. That is, let us call it the "Header".

    Then I use your Formula with the row number replaced by ROW() further down the column, and it does retrieve the required info below the "Header", exactly as I wanted!

    Were you aware that the formula might respond this way with Transposed Data?

  12. #12
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Search & copy data from any of 100 columns in closed WorkBook without opening it

    Were you aware that the formula might respond this way with Transposed Data?
    I was aware that ROW() makes this formula relative to the cell's row in which the formula resides.
    What you mean with 'transposed data' is not clear to me without seeing a worksheet.

  13. #13
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Search & copy data from any of 100 columns in closed WorkBook without opening it

    Hi wamp,

    Have a look and see what "Maverick" a.k.a. snb has provided me with. Try it!

  14. #14
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Search & copy data from any of 100 columns in closed WorkBook without opening it

    I shall quickly try and replicate what I am trying to explain and upload the WB.

  15. #15
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Thumbs up Re: Search & copy data from any of 100 columns in closed WorkBook without opening it

    Hello snb,

    It is probably just an extended blue Monday for me, because when I was building a replication of what the "problem" seemed to be, it miraciously just dissapeared!

    When that happend I changed your code back to just the following:

    Please Login or Register  to view this content.
    It works like a Charm!

    Thank you for your time and unselfish support.

    Thank you Sir!

  16. #16
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Search & copy data from any of 100 columns in closed WorkBook without opening it

    Re rep,

    Hi snb, I have done just so. It may be that your PM was Nano seconds faster than the Rep I have posted

    I have also posted you to my wall of "People Of Note" a long time ago, and if I really find myself in a serious corner, I might just PM you!

    Baie Dankie!!!


    ......exceeded their stored private messages quota and cannot accept further messages until they clear some space.

  17. #17
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Search & copy data from any of 100 columns in closed WorkBook without opening it

    I fear you have to clear up the PM's yourself.

    Niks nie dankie nie.

  18. #18
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Search & copy data from any of 100 columns in closed WorkBook without opening it

    My side is clean thank you!

    This line:

    exceeded their stored private messages quota and cannot accept further messages until they clear some space.
    applies to on your side

  19. #19
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Search & copy data from any of 100 columns in closed WorkBook without opening it

    You are absolutely right !
    One of the advantages of the 'up'graded forum: no indication of the inbox content...

+ 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