+ Reply to Thread
Results 1 to 5 of 5

Vba To Copy Data From Wkbk1 To Wkbk2

  1. #1
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro 2003 / 2010
    Posts
    423

    Vba To Copy Data From Wkbk1 To Wkbk2

    I need a macro that will do the following on the attached example.

    Run down Column B and for every instance of 01|13 copy the adjacent isbn in column C.

    For 01|13 entries paste the copied data as values into another workbook called Workbook 2 in cell A10, then A11 etc.

    For 02|13 entries paste the copied data as values into another workbook called Workbook 2 in cell A60, then A61 etc.

    For 03|13 entries paste the copied data as values into another workbook called Workbook 2 in cell A110, then A111 etc.

    i.e. every time the month changes by 1 jump down to A60 then A110 then A160 etc.

    Sometimes these ranges change so it would be helpful if the first cell for each month to be pasted into it is defined in the macro i.e. Range("A10").Select for example. Rather than just assuming the data will be 50 rows apart.

    This is one sheet of a set and some sheets don't have 01|13 throught to 04|13 and there are other variations so the macro needs to be able to work out that if the number in B6 is 05|13 it needs to paste into A210.

    I have given an example on sheet 2 of the attached example.

    Many thanks.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: Vba To Copy Data From Wkbk1 To Wkbk2

    KEEP BOTH THE WORKBOOKS WKBK1 AND WKBK2 OPEN
    park these macros in the vbeditor of workbook wkbk1

    now try this macro "test"(macro undo is to clear wkbk2 so that you can retest)

    for redesigning the various parameters see the comments agianst the various variables carefully.

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    Last edited by venkat1926; 03-21-2011 at 08:43 AM.

  3. #3
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro 2003 / 2010
    Posts
    423

    Re: Vba To Copy Data From Wkbk1 To Wkbk2

    This part of the macro is picking up the range A:C instead of just C.

    r.Offset(1, 0).Resize(r.Rows.Count - 1, r.Columns.Count).SpecialCells(xlCellTypeVisible).Copy

  4. #4
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro 2003 / 2010
    Posts
    423

    Re: Vba To Copy Data From Wkbk1 To Wkbk2

    If anyone can help with my last post re this problem I would be grateful.

  5. #5
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro 2003 / 2010
    Posts
    423

    Macro Picking Up Wrong Range

    Can someone help me with this please?

    The macro was kinldy supplied by a member of the forum. I think that this part of the macro is picking up columns A:C rather than just column C.

    Can anyone advise on how to change it please?

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    r.AutoFilter
    Next j
    End Sub

+ 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