+ Reply to Thread
Results 1 to 19 of 19

Worksheet Change event not updating when data is copied

  1. #1
    Registered User
    Join Date
    11-24-2016
    Location
    London
    MS-Off Ver
    ms OFFICE 2010
    Posts
    42

    Worksheet Change event not updating when data is copied

    Hi experts,

    Is it possible to have a worksheet change event updated if data is copied from one cell to another. It updates if the data is manually amended/entered, but I suspect some users will copy and paste into the cell, in which case the code is not working for that.

    I'm not sure how to post the code in here (as I think it has to be a certain way). Last time, I violated the requirements by posting code in the forum. Can someone assist how I can post the code and I'll do that so the code can be looked at (if it is possible to update information on another sheet using a change event when data is copied rather than manually entered).

    Thankyou heaps:-)

  2. #2
    Forum Contributor
    Join Date
    01-03-2018
    Location
    Fukuoka, Japan
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: Worksheet Change event not updating when data is copied

    Hi, notemore. Yes, worksheet change event does work when data is copied and pasted. Here's a simple code for testing purpose. Check if the message box appears when you copy data and paste into the other cell.

    Please Login or Register  to view this content.
    When you post the code, just wrap the code with [CODE] tags.
    Please refer to forum rule #3.

  3. #3
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Worksheet Change event not updating when data is copied

    " how I can post the code"
    Very simply put your code and select it, then clic on the # icon above your thread
    Another way
    [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code]
    Last edited by PCI; 02-04-2018 at 04:15 AM.
    - Battle without fear gives no glory - Just try

  4. #4
    Registered User
    Join Date
    11-24-2016
    Location
    London
    MS-Off Ver
    ms OFFICE 2010
    Posts
    42

    Re: Worksheet Change event not updating when data is copied

    HI

    Thankyou as I was not sure how to go about it. this code is from the expert Sktneer and it does exactly what I want except when data is copied or pasted. A user must enter in the cell manually and press enter for it to work. I need the flexibility to allow copying and updating with multiple cells as well . A user might copy info from one cell and paste it in 3 cells in the same row or another row.

    Please Login or Register  to view this content.
    What should be amended in this code to allow copying and pasting info on multiple cells to occur and be updated to another sheet.

    Many thanks.

  5. #5
    Registered User
    Join Date
    11-24-2016
    Location
    London
    MS-Off Ver
    ms OFFICE 2010
    Posts
    42

    Re: Worksheet Change event not updating when data is copied

    Yes, the code is using the same worksheet change event and it doesn't update if copied, it only triggers when enter is pressed

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Worksheet Change event not updating when data is copied

    Something else must be going on. Worksheet_Change events DO trigger when data is copy/pasted. Any time data is physically changed on the sheet, whether it be a single cell edit or an en masse paste, it triggers.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  7. #7
    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 event not updating when data is copied

    Perhaps this for multiple cells
    Please Login or Register  to view this content.
    Last edited by xlnitwit; 02-05-2018 at 11:07 AM. Reason: Overlooked the obvious!
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  8. #8
    Forum Expert
    Join Date
    10-02-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    1,222

    Re: Worksheet Change event not updating when data is copied

    Its early (for me) so maybe I am mistaken but doesnt the first line cause the OP's issue?

    Please Login or Register  to view this content.
    Doesn't that line basically say if the target is more than a single cell to exit the event?

    it only triggers when enter is pressed
    Thats not how Worksheet_Change event works. Ill bet if you copy/paste a single cell it works just fine.
    Ways to get help: Post clear questions, explain your overall goal, supply as much background as possible, respond to questions asked of you by those trying to help and post sample(s) files.

    "I am here to help, not do it for people" -Me

  9. #9
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Worksheet Change event not updating when data is copied

    Hi notemore,

    Is your event code behind a worksheet or in a general module. Event code needs to be in the module behind the worksheet for it to recognize events in that single sheet.

    http://www.cpearson.com/excel/Events.aspx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  10. #10
    Registered User
    Join Date
    11-24-2016
    Location
    London
    MS-Off Ver
    ms OFFICE 2010
    Posts
    42

    Re: Worksheet Change event not updating when data is copied

    I tried that line, and commenting it out and the same thing happens.

  11. #11
    Registered User
    Join Date
    11-24-2016
    Location
    London
    MS-Off Ver
    ms OFFICE 2010
    Posts
    42

    Re: Worksheet Change event not updating when data is copied

    No copy paste for a single cell doesn't work either.

  12. #12
    Registered User
    Join Date
    11-24-2016
    Location
    London
    MS-Off Ver
    ms OFFICE 2010
    Posts
    42

    Re: Worksheet Change event not updating when data is copied

    It says: For sheet (both worksheet and chart sheet) level events, the event procedure code must be placed in the Sheet module associated with that sheet.

    It is placed at the worksheet (in the sheet module) associated with that sheet. But it copies to another page, perhaps that is where the issue is?

  13. #13
    Registered User
    Join Date
    11-24-2016
    Location
    London
    MS-Off Ver
    ms OFFICE 2010
    Posts
    42

    Re: Worksheet Change event not updating when data is copied

    There is another piece of code which is in the module. it is called to update the date. A dropdown on the other sheet.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by notemore; 02-05-2018 at 03:28 PM. Reason: code tags

  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 event not updating when data is copied

    Did you test the code in post 7? If so, what happened?

  15. #15
    Registered User
    Join Date
    11-24-2016
    Location
    London
    MS-Off Ver
    ms OFFICE 2010
    Posts
    42

    Re: Worksheet Change event not updating when data is copied

    xlnitwit

    sorry, I overlooked and missed your post with the updated code. It works a treat... awesome - thankyou.

  16. #16
    Registered User
    Join Date
    11-24-2016
    Location
    London
    MS-Off Ver
    ms OFFICE 2010
    Posts
    42

    Re: Worksheet Change event not updating when data is copied

    oh goodness, where is the solved button?

  17. #17
    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 event not updating when data is copied

    It’s in the Thread Tools dropdown at the top of the page.

  18. #18
    Registered User
    Join Date
    11-24-2016
    Location
    London
    MS-Off Ver
    ms OFFICE 2010
    Posts
    42

    Re: Worksheet Change event not updating when data is copied

    Thank you, I found it and marked it as solved. But I can't tell whether the credit/acknowledgment went to you? Am I missing something, do I need to do anything else?

  19. #19
    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 event not updating when data is copied

    That is all you need to do, though you may additionally click the Add reputation button in the bottom left of any post you found useful, in order to thank all those that helped.

+ 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. Worksheet Change event and data tables
    By sachinkapasi in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-29-2014, 03:26 PM
  2. [SOLVED] Worksheet change event with data validation
    By Dacodac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-08-2013, 05:36 AM
  3. Updating cells without using worksheet change event?
    By dsexpress in forum Excel General
    Replies: 1
    Last Post: 04-25-2008, 01:46 PM
  4. [SOLVED] Worksheet change event for data validation??
    By Meltad in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-01-2006, 11:00 AM
  5. Replies: 5
    Last Post: 06-23-2005, 06:05 PM
  6. [SOLVED] Updating another sheet using an On Change event
    By Steve Barber in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-25-2005, 11:06 AM
  7. WorkSheet Event - Copied
    By RWN in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-05-2005, 02:06 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