Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,422
    Thanks
    125
    Thanked 5 Times in 5 Posts

    VBA Code to extract specific Data

    I would like a macro to open up a source workbook and to copy the data into the destination workbook as follows:


    1) Where the name in E2 matches the name in the destination workbook, Col B (these are in row B7:B40) , I need the value in Col F that is in the same row where "Zero Rate" appears, to be copied into col N, in the same row where the names matches the source workbook
    2) Where the name in E2 matches the name in the destination workbook, Col B (these are in row B7:B40) , I need the value in Col F that is in the same row where "Exempt" appears, to be copied into col M, in the same row where the names matches the source workbook


    I have attached sample data from the source workbook as well as the destination workbook


    Your assistance in this regard is most appreciated

    http://www.mrexcel.com/forum/showthr...02#post3218402
    Attached Files Attached Files
    Last edited by HowardC; 2012-07-24 at 14:27.

  2. #2
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts
    Just a point of process: When doing this kind of work, instead of manipulating the original file and then saving it to another workbook I really prefer to save the original file under a new name and start from there. This way, if anything fatal happens during my code execution, my original data stays safe and sound. If you want to autoname the file try using ActiveWorkbook.SaveAs somestringthatishardcoded or prompt the user to save the file try application.Dialogs(xlDialogSaveAs).Show When you write something that satisfies you, save it as a separate module. I can guarantee, you'll reuse it. Now, instead of looking for your data rows, you will end up deleting everything that doesn't match your criteria.
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  3. #3
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,422
    Thanks
    125
    Thanked 5 Times in 5 Posts
    Hi Catharine

    This is not what I was asking for. What I am looking is to copy certain values based on certain criteria from the source workbook to the destination workbook.

    It would be appreciated if you could assist me

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •