+ Reply to Thread
Results 1 to 6 of 6

Copy row to the next blank row in another workbook

  1. #1
    Registered User
    Join Date
    03-21-2017
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    3

    Copy row to the next blank row in another workbook

    Hi All,
    In a bit of a bind, i have a simple excel user form which has a button that when clicked validates the data and then inserts this into a worksheet.
    I have this part working fine.
    However i now need this row of data to be inserted in the next blank row to a workbook located somewhere else on the network. I have come across the vba below but i am struggling with getting this function running after the validation.

    Public Sub copy_wb()

    Dim copy_from As Range
    Dim copy_to As Range

    Set copy_from = Workbooks("book1").Worksheets(1).UsedRange
    Set copy_to = Workbooks("book2").Worksheets(1).Range("A" & Rows.Count).End(xlUp).Offset(1, 0)

    copy_from.Copy Destination:=copy_to
    Application.CutCopyMode = False

    End Sub

    Can anyone help me cheers in advance.

    Kind regards

    Me

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Copy row to the next blank row in another workbook

    Please add code tags to your post as per forum rules.

  3. #3
    Registered User
    Join Date
    03-21-2017
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Copy row to the next blank row in another workbook

    Apologies first time posting here.

    Please see below
    Please Login or Register  to view this content.
    Let me know if you require anything else

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Copy row to the next blank row in another workbook

    Thanks. You could have just edited your original post. So, what is the problem exactly?

  5. #5
    Registered User
    Join Date
    03-21-2017
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Copy row to the next blank row in another workbook

    Sorry been staring at this all day.
    2 points really
    Will the above code work in copying the data from one location to another over a network as long as permissions etc align.
    how do i add this so that once the validation runs it completes copy and paste.

    So in short i am struggling to get the button to complete more that one task,

  6. #6
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Copy row to the next blank row in another workbook

    Not sure what you mean. The workbooks will need to be open, or opened by code, but otherwise should be ok I think. You can add a button and then assign this macro to it, or you could add to an event such as worksheet change if it is to be triggered by a cell changing.

+ 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. Macro Help. Copy & Paste data from workbook to next blank cell in column B.
    By Jade1987 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-23-2016, 07:34 AM
  2. [SOLVED] Copy column to next blank column to another workbook
    By jump01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-22-2016, 04:53 AM
  3. [SOLVED] VB Code to copy data in closed workbook at 1st blank cell
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-04-2016, 01:32 AM
  4. [SOLVED] macro to copy columns even blank to another worksheet in same workbook
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-29-2016, 03:09 PM
  5. Copy workbook structure & formulas to new blank workbook
    By bweight in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-07-2015, 05:32 PM
  6. [SOLVED] VBA to copy entire worksheet to a blank existing sheet in same workbook
    By Jon123 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-04-2012, 06:06 PM
  7. Workbook to workbook copy by avoiding blank cells
    By sivdin in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-17-2011, 05:38 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