+ Reply to Thread
Results 1 to 7 of 7

File Open and Search column from A1:CE1. If matched than copy entire row for that column.

  1. #1
    Registered User
    Join Date
    08-26-2014
    Location
    Delhi
    MS-Off Ver
    2007
    Posts
    11

    File Open and Search column from A1:CE1. If matched than copy entire row for that column.

    Search column from A1:CE1. If matched than copy entire row for that column.

    I have a folder, which contains 1000 of excel workbook, I am trying to open workbook 1 by 1. In sheet 1 I am searching all columns using case.

    Now problem is that I want to copy entire row 1 by 1 if column matched.
    For example:
    Please Login or Register  to view this content.

    Your help will be much appreciated.
    Attached Files Attached Files
    Last edited by shivanisachdeva167; 11-04-2014 at 02:33 AM.

  2. #2
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: File Open and Search column from A1:CE1. If matched than copy entire row for that colu

    Hi Shivan

    Please use Code Tags, first edit your post by adding code tag to your code

    after editing your thread provide sample workbook of master file & source file
    Thanks - Naveed
    -----------------------------
    If the suggestion helps you, then Click * to Add Reputation
    To Attach File: Go Advanced>>Manage Attachments>>Add Files (In Top Right Corner)>>SelectFiles>>.........Locate Your File(s)>>Upload Files>>Done (In Bottom Right)
    1. Use [code] code tags [\code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    2. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: File Open and Search column from A1:CE1. If matched than copy entire row for that colu

    Hi, shivanisachdeva167,

    your code:
    Please Login or Register  to view this content.
    try
    Please Login or Register  to view this content.
    If the column is equal in both sheets you could refer to that column in both commands but you would need to make sure to copy more than just the heading..

    Ciao,
    Holger
    Last edited by HaHoBe; 11-04-2014 at 01:21 PM.
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    08-26-2014
    Location
    Delhi
    MS-Off Ver
    2007
    Posts
    11

    Re: File Open and Search column from A1:CE1. If matched than copy entire row for that colu

    Hello HaHoBe ,

    Thank you all for a prompt reply and assistance. Today I tried your suggestion.
    It is not working for me.

    I am trying to give some intelligence power to my macro. For example opening folder and copy all sheet just copy the static range.

    But I want to try search column using case. If found then copy rows value for all workbook in a selected folder.


    Once again thanks in advance to Hahobe and Naveed.
    Attached Files Attached Files

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: File Open and Search column from A1:CE1. If matched than copy entire row for that colu

    Hi, shivanisachdeva167,

    It is not working for me.
    Did you receive a run time error, which one? What didnīt work? You would need to elaborate on that.

    I am trying to give some intelligence power to my macro.
    Iīd go with an Application.Match from the destination workbook on the new worksheet rather on that as Iīm afraid VBA wonīt be "intelligent" enough to asssume what you are trying to get, you would need to code it in order to get the proper result. You could use arrays for that although I donīt see the benefit. And you would make sure to havbe the same items being used the headings in every workbook/worksheet as well. If these differ you could try Find or loop and InStr or Like or use an array with synonyms for each item.

    Ciao,
    Holger

  6. #6
    Registered User
    Join Date
    08-26-2014
    Location
    Delhi
    MS-Off Ver
    2007
    Posts
    11

    Re: File Open and Search column from A1:CE1. If matched than copy entire row for that colu

    Thank you for your kind reply. I was trying to fetch all column value listed in case.
    For example date:
    It may have positioned in A1 or B1 or C1. That is why 1’stly I searched column date
    And now I want to paste “Date” column’s row value.

    I am wondering if following syntax can be attached in Case.

    Please Login or Register  to view this content.

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: File Open and Search column from A1:CE1. If matched than copy entire row for that colu

    Hi, shivanisachdeva167,

    the command you posted is sort of overload. Cells refers to all cells on a sheet, so what should CurrentRegion do about that? For Cells the entire sheet is the Cuzrrent Region. If you use a single cell or a small range you may find and use the surrounding region.

    Application,Match will deliver the index of the range being tested if the item is found and in that case delivers a long value while if no match is found an error is delivered.

    You would need to either use Resize for both areas or use copy/paste for just one cell.

    Ciao,
    Holger

+ 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. Search string in a column then copy entire rows to another sheet
    By vannylette in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-12-2013, 12:16 PM
  2. Search results of a column display a set value in another column if matched
    By rkrause54 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-12-2013, 01:59 PM
  3. [SOLVED] How to Copy Column A from File 1 to Column D of File 2 without keeping File 1 open
    By eggcel in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-12-2013, 02:38 AM
  4. Replies: 7
    Last Post: 01-09-2013, 02:28 PM
  5. [SOLVED] Search a column for a value if found copy entire row and paste
    By awagenhurst in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-07-2012, 03:48 PM

Tags for this Thread

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