+ Reply to Thread
Results 1 to 25 of 25

VBA Copy insert into another workbook _ excel 2013

  1. #1
    Registered User
    Join Date
    06-14-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    45

    VBA Copy insert into another workbook _ excel 2013

    Hi

    I need some help here with the following. - Using Excel 2013

    I have a temp worksheet which I format some data - i will be running the macro on this workbook;

    What i need to do is then go to row 2 select all the rows with data in them (i need to select rows as i have data going into column "w" and possibly further)
    With that data selected i need to insert the data into another excel workbook on my c drive called "Data".

    However this workbook also contains data already in it - so what i need to do is to insert the data into the last row which does not contain the data

    Please please can someone help with the coding here will REALLY APPRECIATE IT!!

    Please if you do post any code just preface it so i can understand what is happening at each stage - i do understand a bit of vba but that is just through trial and error with the vba editor

    Regards

  2. #2
    Forum Contributor
    Join Date
    12-19-2012
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: VBA Copy insert into another workbook _ excel 2013

    Hi

    Couple of lines that may help you below, one finds & selects used range minus row 1 (I assumed by your question that you had headers ?) & the other selects row after last used row of active worksheet.

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    Regards
    Steve

  3. #3
    Registered User
    Join Date
    06-14-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: VBA Copy insert into another workbook _ excel 2013

    Hi Steve,

    Thanks for those steps they do help - but after selecting the used range how do insert those rows in the "data" workbook is there some code you could post for that please ?

    Regards

  4. #4
    Forum Contributor
    Join Date
    12-19-2012
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: VBA Copy insert into another workbook _ excel 2013

    Just working on that (I'm a beginner myself so not as quick as others to answer!), will the workbook "Data" be open or does the macro have to open it, also what is the name of the worksheet that the data should be copied to?

  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: VBA Copy insert into another workbook _ excel 2013

    After your copy command if Data is already open
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-14-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: VBA Copy insert into another workbook _ excel 2013

    Hi

    there is only one sheet in that book and yes the macro will have to open it i believe unless it doesnt need to - the name of the worksheet changes so that cannot be used as a reference point

    Regards

  7. #7
    Forum Contributor
    Join Date
    12-19-2012
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: VBA Copy insert into another workbook _ excel 2013

    To open workbook (in this example it is on my desktop)

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    12-19-2012
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: VBA Copy insert into another workbook _ excel 2013

    Using John's code line from above reply this may work for you if you change file path for "Data" workbook and worksheet name

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-14-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: VBA Copy insert into another workbook _ excel 2013

    Hi John

    If I rename the sheet name everytime i use the macrowith yesterdays date isnt that going to be a problem in that coding ?

  10. #10
    Forum Contributor
    Join Date
    12-19-2012
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: VBA Copy insert into another workbook _ excel 2013

    John,

    If you dont mind, is the code I enetred ok? it seems to work but wouldnt want to lead someone down the garden path so to speak!

  11. #11
    Forum Contributor
    Join Date
    12-19-2012
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: VBA Copy insert into another workbook _ excel 2013

    if you only have 1 worksheet in the "Data" file you can use the "ActiveSheet.Name" as below. This way it doesnt matter if you keep renaming worksheet.

    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    12-19-2012
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: VBA Copy insert into another workbook _ excel 2013

    Forgot to save and close "Data" workbook so added a few lines for that too.

    Please Login or Register  to view this content.

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

    Re: VBA Copy insert into another workbook _ excel 2013

    Quote Originally Posted by silverxx12 View Post
    Hi John

    If I rename the sheet name everytime i use the macrowith yesterdays date isnt that going to be a problem in that coding ?
    Yes as it stands now, but it can be modified depending on how you enter the date

    Please Login or Register  to view this content.

  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: VBA Copy insert into another workbook _ excel 2013

    Quote Originally Posted by Steve@TRW View Post
    John,

    If you dont mind, is the code I enetred ok? it seems to work but wouldnt want to lead someone down the garden path so to speak!
    Steve, your code seems fine too me. It should work just as well.

  15. #15
    Forum Contributor
    Join Date
    12-19-2012
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: VBA Copy insert into another workbook _ excel 2013

    Hi, dont know if you need this but added more code to automatically change worksheet name in "Data" workbook to yesterdays date when macro is run.

    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    06-14-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: VBA Copy insert into another workbook _ excel 2013

    Ok

    I am using part of both of your codes as below:

    Please Login or Register  to view this content.
    The problems i am faced with are as follows :

    the header row from the temporary data sheet seems to be copied as well - how do i get rid of that i only wish to copy from rows 2 down?

    Also i want to insert the copied cells not paste them after the last row of data as the workbook has formulas at the bottom -

    Thanks really appreciate the help

    so i really i need to copy the data open the workbook

  17. #17
    Forum Contributor
    Join Date
    12-19-2012
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: VBA Copy insert into another workbook _ excel 2013

    can you attach a copy of temp workbook?

  18. #18
    Forum Contributor
    Join Date
    12-19-2012
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: VBA Copy insert into another workbook _ excel 2013

    to clarify which row are your headers on ?

  19. #19
    Registered User
    Join Date
    06-14-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: VBA Copy insert into another workbook _ excel 2013

    Hi

    The temp book looks like this starting from a1 (row 1 is headers)

    Date time amount value
    1 3 4 5
    2 2 50 78

    The data i want copied begins in row 2 going across the worksheet and down to the last row of data in it

    Hope that clarifies it

    each number is supposed to be under each heading
    Last edited by silverxx12; 01-09-2014 at 09:34 AM.

  20. #20
    Forum Contributor
    Join Date
    12-19-2012
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: VBA Copy insert into another workbook _ excel 2013

    It clarifies it but not sure why it does not work as it works with my workbooks, can you attach your files? What column are the formulas on, you say last row but do you really mean last row of a table or something similar?

  21. #21
    Registered User
    Join Date
    06-14-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: VBA Copy insert into another workbook _ excel 2013

    Hi

    Sorry steve i cannot attach the file atm -sorry

    To explain, essentially you are adding the data to a larger list of data which has total formulas at the bottom - between the formulas and end of the list of data there are some empty rows

    In the old excel 2003 one was able to copy rows and insert copied rows into another worksheet - that is not a feature in 2013 as it is NOT highlighted after copying the selection- it driving me crazy and that essentially is my problem here.

    If i manually copy them and paste them whilst vba isnt on it works with vba its not highlighted :-(

  22. #22
    Forum Contributor
    Join Date
    12-19-2012
    Location
    England
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: VBA Copy insert into another workbook _ excel 2013

    Sorry, I have no experience with 2013 so i doubt i will be able to help with this particular issue.

    I hope someone else more qualified can help with this.

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

    Re: VBA Copy insert into another workbook _ excel 2013

    I modified your original code to what I think you may want to achieve. See if it helps on a sample.

    Please Login or Register  to view this content.

  24. #24
    Registered User
    Join Date
    06-14-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: VBA Copy insert into another workbook _ excel 2013

    thnk you so much seems to be working now

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

    Re: VBA Copy insert into another workbook _ excel 2013

    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. Userform in Excel 2013 disappears while switching an active workbook behind
    By blackarrow in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-17-2013, 09:08 AM
  2. [SOLVED] Create new workbook, then REFERENCE it, Excel 2013
    By rbrian in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-02-2013, 09:09 AM
  3. How to insert a drop down calander in MS Excel 2013
    By shukla_raj23 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-14-2013, 12:10 PM
  4. Excel 2013 Automatically insert a row when the last formatted row is used
    By lisakay in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-21-2013, 02:46 PM
  5. Replies: 3
    Last Post: 03-29-2013, 12:35 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