+ Reply to Thread
Results 1 to 5 of 5

Copy rows when column matches a user input from another workbook

  1. #1
    Registered User
    Join Date
    07-20-2008
    Location
    Illinois
    Posts
    3

    Copy rows when column matches a user input from another workbook

    Hi,

    This is my first post so I hope this is the right spot to place the question.

    Here is my situation. I have 3 workbooks.

    WB 1 - Input.xls - Is where I put my cell references to run some macros
    WB 2 - Sales.xls - A list of sales by region
    WB 3 - Output.xls - basically where I am formatting the results of the macros, but for this example, we can consider it completely blank.

    I am trying to add a macro that will look at the Input workbook and take the value in cell C5 which is a user input that selects a region (i.e. MW). Use that value and go to my SALES.xls workbook and search the entries where the region (in column T in sales.xls) matches the region from the input. When the region matches, copy and paste the row into the workbook "Output.xls."

    I have also posted this question at mrexcel.com and will post replies in both elocations for future users to reference. Thanks for the help

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482
    Quote Originally Posted by cjc155
    Hi,

    This is my first post so I hope this is the right spot to place the question.

    Here is my situation. I have 3 workbooks.

    WB 1 - Input.xls - Is where I put my cell references to run some macros
    WB 2 - Sales.xls - A list of sales by region
    WB 3 - Output.xls - basically where I am formatting the results of the macros, but for this example, we can consider it completely blank.

    I am trying to add a macro that will look at the Input workbook and take the value in cell C5 which is a user input that selects a region (i.e. MW). Use that value and go to my SALES.xls workbook and search the entries where the region (in column T in sales.xls) matches the region from the input. When the region matches, copy and paste the row into the workbook "Output.xls."

    I have also posted this question at mrexcel.com and will post replies in both elocations for future users to reference. Thanks for the help
    Hi cjc155,
    Check out this example first on how to filter data from one sheet to another.
    http://www.excelforum.com/attachment...9&d=1202188669
    Located at this thread
    http://www.excelforum.com/showthread.php?t=632073
    You will have to supply more detail after you have that figured out
    Last edited by davesexcel; 07-21-2008 at 04:31 AM.

  3. #3
    Registered User
    Join Date
    07-20-2008
    Location
    Illinois
    Posts
    3
    Thanks Dave...I have changed your code a bit and tested on a sample dataset and everything is working so far. I am now going to move it to my production files and see how it works. Hopefully I can make it work without further help. Thanks again - C

  4. #4
    Registered User
    Join Date
    07-20-2008
    Location
    Illinois
    Posts
    3
    Hi Dave,


    Everything works fine save for one issue. In my first column (column A) of the range I have dates. When I paste the range into its new location, the date (in format mm/dd/yyyy) gets an extra day and 4 extra years added on to it. So for example, if my first row had a date of 5/1/2008, the value gets pasted a 5/2/2012. This is my code. Any help would be great. Thanks

    Please Login or Register  to view this content.
    Last edited by davesexcel; 07-21-2008 at 04:30 AM.

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482
    Nothing in your code would do that...
    May require "paste special values" if the dates are formulas, is this the case?
    Last edited by davesexcel; 07-21-2008 at 05:10 AM.

+ 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