+ Reply to Thread
Results 1 to 5 of 5

copy cell data to next empty cell in a defined column

  1. #1
    Registered User
    Join Date
    11-29-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    copy cell data to next empty cell in a defined column

    I have made a simple bookkeeping workbook with several sheets, and now I have added an invoicing sheet. After filling in the invoice, I would like to click a macro button to post to my receivable sheet by copying "invoice date" cell, "invoice number" cell, the "total" cell, the "tax amount" cell to my receivable worksheet in the first empty cell in the corresponding column for that item. I realize that it would be the same macro or vb code for each of those action with a change to cell and column references, but I am very green to vb and was hoping that there are some examples out there that are similar that I can understand and modify easily.

    thanks

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: copy cell data to next empty cell in a defined column

    My approach to this common task is always the same.

    Create a contiguous range of cells in a row, and link each one to the invoice date, number, total, tax amount.....and any other invoice details you want to record. Name this range of cells say "new_record". Link each of these cells to the invoice cell that carries the information.

    Now assuming your receivable sheet has a tab name "Receivable" create the following macro and add it to a button which you put on the Invoice tab.

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    11-29-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: copy cell data to next empty cell in a defined column

    I tried the macro instruction Richard but I keep getting a compile error. I have placed the linked range of cells called new_record in the Invoice sheet, and the macro button is also in the Invoice sheet. Is that correct?

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: copy cell data to next empty cell in a defined column

    Hi,

    Yes on the invoice sheet is fine.

    Upload your workbook if you can't get it to work.

  5. #5
    Registered User
    Join Date
    11-29-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: copy cell data to next empty cell in a defined column

    Hi,
    attached is my workbook. I tried to debug it by stepping but I couldn't see where the problem is.

    The end goal is to post in the appropriate month sheets. Once it works I was going to create a button/macro for each month on the invoice sheet so that I can post in to each individual monthly tab. For now I created the receivable tab using one of the month worksheet as a template to test the macro. I wanted to post these cells to these columns:

    Invoice Date should post to Column A
    Invoice Number =>Column B
    Invoice Total =>Column U
    Invoice Tax=>Column AD

    thanks for any thoughts you might have on this.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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