+ Reply to Thread
Results 1 to 14 of 14

Copy range of cells to another file (dinamic name)

  1. #1
    Registered User
    Join Date
    07-24-2013
    Location
    Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    33

    Copy range of cells to another file (dinamic name)

    Hello,

    I am pretty new in VBA programming and i will need your help. I am sure is not so hard for experienced programmer but i am fighting (googling) with it almost 3 days. I have one file with 250 numbers in cells A1:A250 .
    I need to copy them in another file in specific place split by 50 (always same cells) B2:B51 D2:D51 F2:F51 H2:H51 J2:J51.

    File with data have always same name. The file where i need to copy the data have always different name.

    It is possible to add command button that i press to copy the data? Both files are open during the process.

    If you need more info please let me know.

    Thanks very much for help.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copy range of cells to another file (dinamic name)

    Assumes you don't have a Personal.xls file. And you opened the file with data first.

    Please Login or Register  to view this content.
    Or if you do have a Personal.xls

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copy range of cells to another file (dinamic name)

    Assumes you don't have a Personal.xls file. And you opened the file with data first.

    Please Login or Register  to view this content.
    Or if you do have a Personal.xls

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-24-2013
    Location
    Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: Copy range of cells to another file (dinamic name)

    I do not have Personal.xls , it is possibel to add this macro in to the button? The button will be in the data file.

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copy range of cells to another file (dinamic name)

    Yes. The first one then.

  6. #6
    Registered User
    Join Date
    07-24-2013
    Location
    Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: Copy range of cells to another file (dinamic name)

    Hi John,

    I tried the macro and received an error. Anyway i am not sure if it will do what i meant. I attached examples of files .As i said the button should be in Data file from where i will copy to the Result file by pressing it. The data should go in to the yellow cells. Most important thing that the result file have always different name.

    Thanks for your responds.
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copy range of cells to another file (dinamic name)

    What error did you receive? I tested this on your files and it worked.

    Please Login or Register  to view this content.
    You must remember to open your data file first.

  8. #8
    Registered User
    Join Date
    07-24-2013
    Location
    Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: Copy range of cells to another file (dinamic name)

    Hello John,

    Your macro work perfectly with new empty sheet. But i am getting error 1004 when i am trying copy the data in my form file. I font know if the fact that cells in my form are locked and only unlocked cells are (B2:B51 D2:D51 F2:F51 H2:H51 J2:J51)
    I will try to work around but so far no success.

  9. #9
    Registered User
    Join Date
    07-24-2013
    Location
    Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: Copy range of cells to another file (dinamic name)

    Hello John,

    Your macro work perfectly with new empty sheet. But i am getting error 1004 when i am trying copy the data in my form file. I don't know if the fact that cells in my form are locked and only unlocked cells are (B2:B51 D2:D51 F2:F51 H2:H51 J2:J51)
    I will try to work around but so far no success.

  10. #10
    Registered User
    Join Date
    07-24-2013
    Location
    Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: Copy range of cells to another file (dinamic name)

    Hello John,

    I tried all evening and morning today and the macro wont work in locked file (company form). As i wrote above the cells (B2:B51 D2:D51 F2:F51 H2:H51 J2:J51) are unlocked but the macro stop and give me erroe 1004 anyway. Can you help me with that? It will help me alot in work becasue i am caopy/paste alot of statistic data

    Thanks very much.

  11. #11
    Registered User
    Join Date
    07-24-2013
    Location
    Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: Copy range of cells to another file (dinamic name)

    Hello John,

    I found the problem (hidden sheet) and now it is working exactly as i expected. Thanks very much for your suppert. Only one small issue. It is possible to copy only values without formating? Becasue it is change the formating in the form. Thanks

  12. #12
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copy range of cells to another file (dinamic name)

    Maybe:

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    07-24-2013
    Location
    Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    33

    Re: Copy range of cells to another file (dinamic name)

    John,

    You are my Hero. You saved me alot of thime thanks you very much.

  14. #14
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copy range of cells to another file (dinamic name)

    You're welcome. Glad to help out and thanks for the feedback. Please comply with Forum Rule No. 9.

    9. Acknowledge the responses you receive, good or bad. If your problem is solved, please say so clearly, and mark your thread as Solved: Click Thread Tools above your first post, select "Mark your thread as Solved". Or click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Dropdown option or Edit button will not appear -- ask a moderator to mark it

+ 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. [SOLVED] Loop through folder and create tab for the short name of each file and copy range of cells
    By mongoose36 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-06-2013, 02:08 PM
  2. [SOLVED] Trouble with dinamic chart - Blank cells from if statement
    By Portuga in forum Excel Charting & Pivots
    Replies: 8
    Last Post: 03-26-2013, 12:47 PM
  3. Replies: 3
    Last Post: 02-19-2013, 01:08 AM
  4. Replies: 1
    Last Post: 02-10-2013, 07:35 PM
  5. Determine a dinamic range
    By BittyBite in forum Excel General
    Replies: 0
    Last Post: 02-24-2005, 08:24 AM

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