+ Reply to Thread
Results 1 to 7 of 7

Using command button to copy cell contents and paste to different sheet, then clear cells

  1. #1
    Registered User
    Join Date
    09-06-2013
    Location
    Northamptonshire, England
    MS-Off Ver
    Excel 2003
    Posts
    45

    Using command button to copy cell contents and paste to different sheet, then clear cells

    Afternoon all,

    I am looking to utilize some VBA assigned to a command button that will in essence copy the contents numerous cells in sheet 1 and paste them into specific rows in sheet 2.

    Sheet 1 is essentially a 'Data Entry' form, sheet 2 is a 'Master' sheet containing all data entered historically. For example, the command would copy the contents of cell A1 in sheet 1 and paste it to the next available cell in column A of sheet 2. Once all relevant cells were copied to their corresponding columns in sheet 2 all relevant sheet 1 cells should be cleared ready for the next data entry.

    Unfortunately i do not have a finished example sheet currently but these are some of the cells that would require copying (along with their assigned paste rows)

    X4 to Sheet2!G:G
    X5 to Sheet2!C:C
    X6 to Sheet2!D:D
    X7 to Sheet2!E:E
    X8 to Sheet2!F:F
    E24 to Sheet2!L:L
    O24 to Sheet2!M:M

    etc...etc (there are a few more which hopefully I would be able to figure out how to add once the code structure is in place)

    Any help on this would be greatly appreciated.
    I'm aware it may seem like a somewhat easy request, the thing that is stumping me most in the next available row part.

    Thank you in advance,
    Regards

    Ethanrholt
    Last edited by Ethanrholt; 07-23-2015 at 11:32 AM.

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Using command button to copy cell contents and paste to different sheet, then clear ce

    Hi there,

    The following code might help you to get started - it shows how to locate the next available row on the Master worksheet:

    Please Login or Register  to view this content.
    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  3. #3
    Registered User
    Join Date
    09-06-2013
    Location
    Northamptonshire, England
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Using command button to copy cell contents and paste to different sheet, then clear ce

    Hi Greg,

    Thank you for your response. I will use your code as a base and see how I get on.

    Much appreciated!
    Regards
    Ethanrholt

  4. #4
    Registered User
    Join Date
    09-06-2013
    Location
    Northamptonshire, England
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Using command button to copy cell contents and paste to different sheet, then clear ce

    Hi, sorry but unfortunately this is still a little advanced for me.

    I think i'm getting a bit confused because I am copying from cells all over the place. Would it be cheeky to ask whether you would be able to use one of the cell examples I outlined above and incorporate it into your code? I do believe once I see what the code structure is I will be able to cobble the rest together.

    Thanks for your patience.

    Ethanrholt

  5. #5
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Using command button to copy cell contents and paste to different sheet, then clear ce

    Hi again,

    See if the attached code does what you need - I've omitted clearing the original data cells once their contents have been copied to the Master worksheet, but that shouldn't be too difficult for you to include.

    Please Login or Register  to view this content.
    Hope this helps - please let me know how you get on with it. If you need any explanation just let me know.

    Regards,

    Greg M

  6. #6
    Registered User
    Join Date
    09-06-2013
    Location
    Northamptonshire, England
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Using command button to copy cell contents and paste to different sheet, then clear ce

    I seem to have managed to get it working. Thanks for your assistance Greg.

    much appreicated
    Last edited by Ethanrholt; 07-24-2015 at 04:31 AM.

  7. #7
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Using command button to copy cell contents and paste to different sheet, then clear ce

    Hi again,

    Many thanks for your feedback - glad I was able to help.

    Best regards,

    Greg M

+ 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] Command button to copy cells from one sheet and paste in second sheet
    By waratdenison in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-22-2014, 02:53 PM
  2. [SOLVED] copy selected row and paste it to another sheet command button vba
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-22-2014, 03:22 AM
  3. [SOLVED] VBA Code to copy all data from sheet 1 and paste it to sheet5 using a command button
    By Angnz in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-10-2013, 10:06 PM
  4. Copy cell content and paste into another cells in the same sheet using add button
    By Amoursi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-04-2013, 02:28 AM
  5. Replies: 18
    Last Post: 02-10-2013, 05:32 PM
  6. Copy and paste cell contents using a button
    By bjscuba135 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-25-2012, 09:44 AM
  7. Clear Contents Macro-a Command Button
    By Andy Small in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-23-2009, 05:29 AM

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