+ Reply to Thread
Results 1 to 8 of 8

Copy Template Workbook and paste specifc range

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Copy Template Workbook and paste specifc range

    Hello everybody
    I have two workbooks : "Copy Workbook Template" this is the main workbook and "Template" workbook
    I intend to copy the template workbook and name it according to the values in column C
    Please Login or Register  to view this content.
    That's my working code except for this line
    Please Login or Register  to view this content.
    Everything is ok .. I need to copy the range from column B to column P according to the suitable row
    the copied range from the main workbook to be pasted in the range("B3:B17") in the new copied workbook

    Here' an attachment that illustrates my requirement
    Attached Files Attached Files
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Copy Template Workbook and paste specifc range

    I just need to copy the range related to every row to he new copied workbook to range("B3:B17")

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Copy Template Workbook and paste specifc range

    My brothers
    Just one line to be edited .. I tried every possible combination for me but I failed

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Copy Template Workbook and paste specifc range

    I thought it is easy but after many tries I failed and I can't figure it out
    please help me

  5. #5
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Copy Template Workbook and paste specifc range

    The array you are referencing is one of values, not ranges, so you can't use it that way.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  6. #6
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Copy Template Workbook and paste specifc range

    Hi,

    When you use this statement :
    Please Login or Register  to view this content.
    the values of Arr variable is "a copy" values of range A1:S5, not the range object itself (for example if you try run this statement: Debug.Print Arr.Address, will raise an error, because Arr is not a range object, but "a copy" values of the range)

    So after above statement, the values of Arr are :
    Please Login or Register  to view this content.
    So this statement :
    Please Login or Register  to view this content.
    is completely error, the parameter for the .cells() is numbers which point to row and column of target cell, so it must be something like :
    .Cells(5, 1)
    .Cells(2, 3)
    etc

    but you try to put :
    .Cells(Arr(I, 2))
    which is :
    .Cells("Emp No-1")
    so this is error, you don't provide two numeric values, which are the row number and the column number

    You previously have made a copy of source range to Arr variable, so it is not needed to retrieve the values from the source range anymore (using .cells() or .range()), but use the Arr instead.
    The values that need to returned is a small part of the big array, so I make a smaller array (named ArrPart) to get the needed values using this code:
    Please Login or Register  to view this content.
    and then put this ArrPart to target range.


    Please Login or Register  to view this content.


    Regards
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

  7. #7
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Copy Template Workbook and paste specifc range

    This modification seems to work:

    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Copy Template Workbook and paste specifc range

    Mr. Karedog
    Mr. Arkadi
    Thank you very much for these great solutions and for the valuable information you provided
    Thanks a lot

+ 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. Copy specifc cells from adjacent Workbook
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-19-2014, 08:00 AM
  2. Copy a Template workbook ans paste in a multiple Files in a Folder
    By arvind1979_3 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-24-2013, 09:07 AM
  3. Macro, copy UNLOCKED cell range of sheet in open workbook to workbook template
    By NicksDad in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-31-2012, 11:18 AM
  4. Prevent copy paste from another doc into specifc column in Excel
    By brandanhadlock in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-17-2012, 02:07 PM
  5. Copy/Paste rows with specifc text in column d
    By Mike Woodard in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-08-2006, 05:00 PM

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