+ Reply to Thread
Results 1 to 4 of 4

How to Conditionally Copy of Column from Another Workbook

Hybrid View

JigneshBavishi How to Conditionally Copy of... 02-02-2017, 04:20 AM
JigneshBavishi Re: How to Conditionally Copy... 02-02-2017, 12:07 PM
MarvinP Re: How to Conditionally Copy... 02-02-2017, 01:39 PM
JigneshBavishi Re: How to Conditionally Copy... 02-03-2017, 07:21 AM
  1. #1
    Registered User
    Join Date
    07-03-2016
    Location
    INDIA
    MS-Off Ver
    2013
    Posts
    38

    Question How to Conditionally Copy of Column from Another Workbook

    Hi,

    (1) I have sample workbook named "Database" as master database, in which I have 20 columns of data for 10 items (named A to J) with each item is having data in 2 adjacent columns
    (2) I have another sample workbook named my "MyWorkbook", in which I am randomly selecting some of the 10 items e.g. 5 items in Sheet1
    (3) I want to copy data of both columns pertaining to this randomly selected items from my source file (i.e. Database) and paste it to respective destination cell reference mentioned in "Column C" of my target file (i.e. MyWorkbook)

    For better understanding I am attaching both sample workbooks.. Can anyone help me with VBA code for this please....
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    07-03-2016
    Location
    INDIA
    MS-Off Ver
    2013
    Posts
    38

    Question Re: How to Conditionally Copy of Column from Another Workbook

    Hi,

    In continuation to my above post,

    (1) I have tried to prepare VB code for above query, but it throws error for 2 lines.
    (2) I have prepared 2 macros. Macro1 throws error at 2 lines and when I have modified these 2 lines in Macro2, it runs successfully and generates result. But it is not desired results and I want Macro1 to run successful.

    Please refer revised files attached in this post and help me to resolve these both error please...

    Errors are: (1) I am unable to give relative reference to columns to be copied from source workbook (2) Data can't be pasted to reference cell in target file if reference cell is not in the same worksheet

    Please help to resolve this errors..
    Attached Files Attached Files

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,236

    Re: How to Conditionally Copy of Column from Another Workbook

    Hi,

    I don't understand the problem. Here is what it looks like to me...
    1.*You have a master data workbook with a table in it.
    2.*You have a second workbook where you want to*copy some of the mater data to.

    What do you put in your second workbook that is the filter to the master? Where are those cells in the second workbook?
    Do you expect*the Database/Master to be open at the same time as the MyWorkbook is open?
    Do you need your Database data to be arranged exactly like you have it? It would be a much easier problem if it was a 2 column database. Why do you have*repeated columns?
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    07-03-2016
    Location
    INDIA
    MS-Off Ver
    2013
    Posts
    38

    Red face Re: How to Conditionally Copy of Column from Another Workbook

    Hi Marvin,

    Thanks a lot for your concern and help.

    Now I am able to solve query on my own. You may save both attachments and make necessary changes in file path in Macro and run the macro to see what I was exactly looking for. I have also added some more lines in code to deal with blank cells and values which are not found in source file. Also I have added small VB code to remove blank columns from target file output sheet. Please note that this is a sample file for my learning purpose, where I have only put hypothetical data, but based on this VB code, I can apply the same in my actual file.

    Further I would like to add that I have not taken any training/education on VB or excel. I am a MBA and doing all these just based on guidance from Honorable Gurus like you and others on this and such similar forums, you tube excel and VB tutorial videos and finally applying my efforts and logical skills to get final results.

    Because of above fact, my VB code might not be as per standard good practices of VB and suggestions from you to improve it for my learning is always welcome.

    Once again thanks a lot...
    Attached Files Attached Files

+ 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. Conditionally copying from one workbook and paste results to another workbook -multiple
    By egchristensen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-30-2015, 12:05 PM
  2. [SOLVED] Insert new column and conditionally copy and paste values
    By kriahnadas.oo7 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-28-2013, 10:07 AM
  3. Replies: 0
    Last Post: 07-24-2013, 01:09 PM
  4. Conditionally Copy/Paste Data from one Workbook to another
    By justin19 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-02-2013, 04:48 PM
  5. Search multiple workbook headers and copy column entries to another workbook
    By R3n3gad3-XtC in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-13-2012, 12:47 AM
  6. [SOLVED] Conditionally Copy Cells from Multiple Sheets and Paste in Another Workbook
    By Gos-C in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-07-2012, 09:22 AM
  7. Replies: 6
    Last Post: 09-27-2011, 02:11 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