+ Reply to Thread
Results 1 to 16 of 16

Worksheet_Change not triggered when I copy and paste

  1. #1
    Registered User
    Join Date
    02-06-2014
    Location
    South Africa
    MS-Off Ver
    Excel 2013
    Posts
    42

    Worksheet_Change not triggered when I copy and paste

    I have the code below with the help of John H. Davis. The original sheet will always be empty with the data pasted afterwards, how can I get the code to trigger when new data is pasted in the original sheet?


    Please Login or Register  to view this content.

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Worksheet_Change not triggered when I copy and paste

    Goeie dag, Lucille Boshoff,

    It is difficult to assist without seeing a sample of your Workbook which appears to have some "Named Ranges". A few solutions might be possible. I am sure that JOHN H. DAVIS may come to your rescue again, since he may remember the finer details of your original requirement.

    If not, then please attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate.

    Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

    Baie dandie.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Registered User
    Join Date
    02-06-2014
    Location
    South Africa
    MS-Off Ver
    Excel 2013
    Posts
    42

    Re: Worksheet_Change not triggered when I copy and paste

    Thanks Winson, nice to see a fellow South African here!

    I attached a workbook, the 'Scheme' sheet is where the data will be pasted, thus initially it will be a blank template. When the data is pasted and an amount exceeds R4500 in columns E:G, I need it to copy to the 'Scheme - High Values' sheet. Currently it only copies the detail over when changes is made to values already on the sheet.

    Sorry, but I'm not nearly as clued up with VBA as I would like to be...
    Attached Files Attached Files

  4. #4
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Worksheet_Change not triggered when I copy and paste

    Hi Lucille Boshoff,

    Thank you for the feedback, and sample Workbook.

    Please replace your current Code with the Code below, and let me know if that works for you.

    Please Login or Register  to view this content.
    Groete, Winon.

  5. #5
    Registered User
    Join Date
    02-06-2014
    Location
    South Africa
    MS-Off Ver
    Excel 2013
    Posts
    42

    Re: Worksheet_Change not triggered when I copy and paste

    Hi Winson,

    It works but only when you click on the amount on the 'Scheme' tab it copies it over to the 'High Values' sheet. These sheets usually contain thousands of lines. Preferably it should be copied automatically when the data is pasted....

  6. #6
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Worksheet_Change not triggered when I copy and paste

    Hi Lucille Boshoff,

    Sorry for getting back to you so late. I have tried to make your code to work the way expected, but Excel would not join the "Party".

    Who is Winson?LOL!!! Just kidding, people call me very funny names!

    The "problem" with the code as you have it, is that it will only "fire" when you make manual changes in any Cell/s within the Range("E:G").

    It could also allow for any inadvertently duplications to be accommodated, without an alert of same! Not good.

    Bad news, you cannot have it your way, as woman usually wants.

    Good news, as I am from "Mars", the attached sample Workbook demonstrates a fail proof workaround, which does what is possible, including the removal of "Duplications", should there be any.

    Kind Regards.
    Last edited by Winon; 08-13-2016 at 02:15 AM.

  7. #7
    Registered User
    Join Date
    02-06-2014
    Location
    South Africa
    MS-Off Ver
    Excel 2013
    Posts
    42

    Re: Worksheet_Change not triggered when I copy and paste

    Hi Winon!

    Apologies for misspelling your name, I need to reply on my cellphone as our company's anti-virus blocks replying on threads and the auto-correct changed your name again this morning

    Thanks for being a "Martian" . It works perfectly! Only problem now is I have to duplicate it on another two sheets for Patient and I have almost no clue what you did or how you did it . I tried advanced filtering etc. but cannot duplicate yours...
    Please help?

  8. #8
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Worksheet_Change not triggered when I copy and paste

    Hi,

    Perhaps this will meet your needs.

    Please Login or Register  to view this content.
    Last edited by xlnitwit; 08-15-2016 at 04:05 AM. Reason: Incorrect column
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  9. #9
    Registered User
    Join Date
    02-06-2014
    Location
    South Africa
    MS-Off Ver
    Excel 2013
    Posts
    42

    Re: Worksheet_Change not triggered when I copy and paste

    Thanks xlnitwit,

    This also works great, but only columns E,F & G with values >= R4500 should copy over. If a row has a value >= R4500 in columns H or I only, the row should not copy over... Thus columns H & I can be ignored.

  10. #10
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Worksheet_Change not triggered when I copy and paste

    I have amended the code I posted previously to only check those three columns.

  11. #11
    Registered User
    Join Date
    02-06-2014
    Location
    South Africa
    MS-Off Ver
    Excel 2013
    Posts
    42

    Re: Worksheet_Change not triggered when I copy and paste


  12. #12
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Worksheet_Change not triggered when I copy and paste

    You are most welcome. And thank you for the tip as well.

  13. #13
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Worksheet_Change not triggered when I copy and paste

    Hi Lucille Boshoff,

    Thank you for the feedback, and for adding to my Reputation. Much appreciated!

    In your Post#5 you also state;
    ...These sheets usually contain thousands of lines.Preferably it should be copied automatically when the data is pasted....
    The Code xlnitwit provided you is good, but unfortunately it will not work if you did happen to Paste any Data in Sheets("Scheme"). Also if you inadvertently enter any duplicate Data in Sheets("Scheme"), xlnitwit's Code would gladly play along. Please try to do that, and you will see what I am getting at, since it is quite possible that it could happen with the, "These sheets usually contain thousands of lines."

    To copy the Sheet Scheme - High Values to any other Sheet, you could use Code something like below.

    Please Login or Register  to view this content.
    Please try the attached revised Workbook.

    Regards.

    P.S. @ xlnitwit, Please, I am not criticizing you or your contribution, it is just that Copy & Paste does not "Fire" a check in the WorkSheet_Change Event for Duplications.
    Last edited by Winon; 08-15-2016 at 11:29 AM. Reason: Corrected stupid comment. pointed out by xlnitwit!

  14. #14
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Worksheet_Change not triggered when I copy and paste

    With respect, that is not correct. Copy and paste will trigger a Worksheet_Change event since you are changing cells.

  15. #15
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Worksheet_Change not triggered when I copy and paste

    My apologies xlnitwit, you are correct!

    This line:
    P.S. @ xlnitwit, Please, I am not criticizing you or your contribution, it is just that Copy & Paste does not "Fire" a WorkSheet_Change Event.
    Should read:
    P.S. @ xlnitwit, Please, I am not criticizing you or your contribution, it is just that Copy & Paste does not "Fire" a check in the WorkSheet_Change Event for Duplications.
    With your permission I would like to Edit that error, please?

    Regards.

  16. #16
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Worksheet_Change not triggered when I copy and paste

    Be my guest.

    I admit I did not address the issue of duplicates since it was never mentioned by Lucille.

+ 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. At what point is worksheet_change triggered? - Same value as WS_SelectionChange
    By rodgersmg in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 10-07-2015, 06:08 AM
  2. [SOLVED] detect if worksheet_change is triggered by delete button
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-16-2015, 07:00 PM
  3. Event triggered copy/paste data rows to program defined worksheets
    By K Rose in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-15-2015, 11:34 AM
  4. Worksheet_Change: Not triggered when user deletes a cell's content
    By Klaster in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-25-2014, 01:26 PM
  5. Debug vbs code to copy and paste info from Sh1 to Sh2 triggered by selection
    By FlyFisherman in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-19-2013, 10:26 PM
  6. Worksheet_Change Not Being Triggered
    By Claymation in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-01-2010, 11:56 AM
  7. Time-Triggered Cell Copy/Paste
    By gandolff in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-01-2009, 07:04 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