Consulting

Results 1 to 3 of 3

Thread: Copy row from workbook if...

  1. #1

    Post Copy row from workbook if...

    I need some vba that looks at the two open workbooks. They both have numbers in them in column A. It needs to see if the number is in column A of Workbook2, and if it is, copy the row from Workbook1 and overwrite the row in Workbook2. If it isn't, then it must paste it after the last used row in Workbook2.

    In workbook 1, the numbers aren't in order, but in workbook 2, they need to be.

    Would anyone be willing to help me?

    Thanks so much.

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Is that not what we did here?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    Basically yes, except for the ordering part. If column A has data 3, 4, 6, 7 and what I'm trying to copy has 5 in column A, it needs to insert a row and stick the data before the row with 6 in column A.

    One thing I didn't mention previously; I can't use copy due to the clipboard being open and used in other macros; I have to do something like [VBA]Workbooks("MyWorkbook").Worksheets("MyWorksheet").Range("D" & i).Value = Workbooks("MyWorkbook2").Worksheets("MyOtherWorksheet").Range("O7").Value[/VBA]

Posting Permissions

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