+ Reply to Thread
Results 1 to 8 of 8

Copy, Paste to other sheets

  1. #1
    Forum Contributor
    Join Date
    06-06-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    129

    Copy, Paste to other sheets

    I have a workbook that has 5 Sheets (Sheet1, thru Sheet6). Sheet1 is our Sign In sheet that all the days data is entered. At close of the day we need to copy specific cells to the appropriate report (Sheet2 thru Sheet6) creating report forms to be printed and sent to the appropriate people.
    I am using the simplest one as my test. I have the code I have found online but I can’t get it to work.
    I would appreciate help with this so I can then adapt it to the full workbook.

    Sheet1 code:

    Please Login or Register  to view this content.
    Sheet2 code:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Copy, Paste to other sheets

    The variables SIGN_IN and CREDIT_CARD must be assigned values in the subs.
    Gary's Student

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474

    Re: Copy, Paste to other sheets

    Remove your error statement, then you will know when the error happens,

    You need the correct syntax for the sheets,

    Please Login or Register  to view this content.
    You will have to correct your "or" statement,
    Please Login or Register  to view this content.
    This doesn't make sense, is it Target.row or is it 4?
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    06-06-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    129

    Re: Copy, Paste to other sheets

    Thanks to you both. I am very new to VBA so please excuse my lack of knowledge on terms. I changed the errors in the "Or" statement and the syntax listed above. Could one of you explain what I need to do to assign the variables "SIGN_IN" and "CREDIT_CARD" ? I thought that was the way you addressed them in the code, or should I have used "Sheet1" and Sheet2" ?
    As for the "Ccrn" that is the starting row on the actual form and I thought I had to declare what it was used for and then the starting row. So I guess you just use it as the starting row then? Thanks again for your help.
    Please Login or Register  to view this content.
    Above are my changes.
    I am not sure how to declare the sheet names.

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474

    Re: Copy, Paste to other sheets

    You don't have to, I am assuming other poster did not know those where the names of the sheets.

  6. #6
    Forum Contributor
    Join Date
    06-06-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    129

    Re: Copy, Paste to other sheets

    Thanks this works!! I still have a problem with it.
    My target row on "SIGN_IN" is 5 and on the "CREDIT_CARD" it is Row 4.
    The copy works but it stays on target row for "SIGN_IN" and copies to "SIGN_IN" target row. If I set Ccrn to 4 it prints on row 4 but the next time it reprints to row 4. I know that I need to increment Ccrn by one each time it copies a row but not sure how to do it. Could you tell me how I can do this please? One other thing not all rows on "SIGN_IN" will be copied to "CREDIT_CARD" If payment is by check then it gets posted to another sheet so the rows will not be consecutive.

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474

    Re: Copy, Paste to other sheets

    I am not sure what you mean, I can only go with the example you supplied.

    The will paste to the next row.
    You really don't have to set the worksheet that has the worksheet_change event.

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    06-06-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    129

    Re: Copy, Paste to other sheets

    Thank you so much this works perfectly. I will be able to adapt it as needed for the other sheets in the master file sign in sheet. I hope soon I will be able to write code as clean as your example.

+ 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] Copy Paste From Rawdata Sheets to Multiple Sheets Based on Sheet names
    By farrukh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-16-2017, 11:01 PM
  2. How to copy and paste whole sheets
    By bluezephyr in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 07-19-2013, 09:51 AM
  3. Copy and Paste 3 sheets to 1
    By stevop622 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-31-2013, 05:53 AM
  4. [SOLVED] Copy and Paste over many sheets
    By bjcowen9000 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 02-19-2013, 01:20 PM
  5. [SOLVED] copy and paste values of all sheets into new sheets
    By greatjobtoday in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-20-2012, 01:44 PM
  6. Copy Paste between sheets
    By nicolaforni in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-20-2011, 03:58 AM
  7. copy and paste sheets
    By Mile029 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-15-2010, 06:15 PM

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