+ Reply to Thread
Results 1 to 10 of 10

Code causing data to disapear

  1. #1
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Code causing data to disapear

    Hi Forum,
    The script of code below seems to be deleting most of my information on a spreadsheet but i am not sure why??
    It only happens when once i enter a value into the active cell mentioned below (which is any odd cell in range N) and haven't exited out of that cell yet, meaning the curser is still flashing, and then i select a different sheet so as soon as i return to the original sheet somehow most of my information is gone!

    *If it helps, the code below starts on any odd cell in column "N" and whatever is entered in that cell gets copied to all the odd cells in column "N" that have the same matching PO number which is found on the same row in the odd cell under column "L".

    Please Login or Register  to view this content.
    Any help would be greatly appreciated

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Code causing data to disapear

    Can you post the worksheet? Make up some dummy data if you have to, but make sure it's indicative of your real data.



    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  3. #3
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Code causing data to disapear

    Thank you for your interest in my thread.
    Here is the file which i 'cleaned up" EXAMPLE 1.xlsm.
    So again, make sure macros are working (sometimes these automatic macros stop working when it gets interrupted) and go into the sheet that is named 'Report Center', click on any of the links under the header 'Vendor', you will immediately be brought to the corresponding order on sheets 'Invoiced Orders' the row that you are in should be dark purple, now on sheets 'Invoiced Orders' on the active row go to column "W" and 1 cell below which you will see that it's blank, enter a "Y" in it but don't click out of the cell and instead go back to "Report Center" and then back to "Invoiced Orders", you will see that a large amount of data has gone missing
    *By the way, if you click out of the cell in column "W" and go to "Report Center" and then back to "Invoiced Order" no changes happen except that the row turns green like it's supposed to.

    Looking forward to hearing back from you

  4. #4
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Code causing data to disapear

    Change :
    Please Login or Register  to view this content.
    To:
    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Code causing data to disapear

    Hi Karedog,
    Nice to see you again
    Unfortunately the revision in the code did not change anything, the data still got lost

  6. #6
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Code causing data to disapear

    Hi kosherboy, me too

    After I examined the whole code (you only posted part of it), there are still 4 occurences of "ActiveSheet" keyword. Please change them also to "Me", just like post #4. You can use Find and Replace feature (by pressing Ctrl H) to do this. Hope this help.


    Regards

  7. #7
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Code causing data to disapear

    Wow, that worked!
    Thank you so much
    If it is not too much i would really like to understand what the difference between "activesheet" and "me" is and why my data was disapearing when i used the activesheet version?

  8. #8
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Code causing data to disapear

    You are welcome, thanks for the rep. points.

    Me -> this refer to the sheet where the code is located
    ActiveSheet -> this refer to the active sheet (the one that currently got the focus)

    You put the code in the sheet called "Invoiced Orders"

    If you don't select another sheet, then Me ("Invoiced Orders") is always the same with ActiveSheet (because the focus never left this sheet), so the code is worked.

    But if you select another sheet (for example "Report Center"), then the ActiveSheet become refer to this sheet ("Report Center"), while actually the code must be performed on sheet "Invoiced Orders", so the code need to adjusted.

    Hope this help.


    Regards

  9. #9
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Code causing data to disapear

    I understand, thanks for explaining.
    All the best Karedog!

  10. #10
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Code causing data to disapear

    You are welcome, glad I can help.


    Regards

+ 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] Code causing all open workbooks to close
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-30-2014, 05:57 PM
  2. VBA code causing excel to hangup/ not respond
    By Lizardra in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-03-2013, 05:08 PM
  3. VBA code causing excel SUM formula to zero out
    By geraldkentschmeer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-13-2013, 10:37 AM
  4. Code to find last Column keeps causing an error
    By dwhite30518 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-01-2012, 07:03 PM
  5. Making Charts Appear and Disapear
    By Bob1980 in forum Excel General
    Replies: 4
    Last Post: 01-03-2012, 11:31 AM
  6. Protect/Unprotect code causing out of range error in code
    By Petrolcb41 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-02-2010, 02:34 PM
  7. how to make my row, columns, and toolbars disapear
    By lenty in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-11-2007, 01:19 AM
  8. [SOLVED] Drop down list disapear
    By broogle in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2005, 08:06 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