+ Reply to Thread
Results 1 to 4 of 4

Cut/Paste and Update Values between two sheets (losing rows)

  1. #1
    Registered User
    Join Date
    02-08-2019
    Location
    London
    MS-Off Ver
    365
    Posts
    6

    Cut/Paste and Update Values between two sheets (losing rows)

    Good Evening,

    I'm stuck with this code and I really don't know why, I think that it's a range issue but I can't see it so i thought that you may help me spot it.

    I've a range of data between columns A to R, with a month in R, and a droplist with months.

    I wished to get the data in the "DATA" tab to be displayed in the "JLOP" tab depending of the month value in R,
    this data was then removed from the DATA tab, and when a new month was selected, pasted from JLOP to the Last row of DATA.

    But, everytime I run it, I lose more and more data.

    I thought that it was because I needed to calculate a new Last Row (LRDATA2) or because I would lost 1 row each time (that's why I did LrDATA + 1)
    but I'm losing way more data on every loop...

    I also thought that it might be caused by the ranges used (not starting in A1 etc) but i'm not losing the same number of rows on each loop.

    I know that on the example below, I start with the JLOP one instead of the DATA tab, but that's just so that the script starts with an input.

    Could you help me please or suggest me any improvements please?

    The sheet is full of Employees data so I can't provide it, but I can send an example if needed.

    Thank you very much and sorry for my english.

    Please Login or Register  to view this content.
    Best regards,
    Picsou

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Cut/Paste and Update Values between two sheets (losing rows)

    give this a try. When deleting rows, it is best to work from the bottom of the data to the top.

    Please Login or Register  to view this content.
    Maybe you want to re-evaluate the use of the line of code with a comment in red font.
    Last edited by JLGWhiz; 03-26-2019 at 04:20 PM.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    02-08-2019
    Location
    London
    MS-Off Ver
    365
    Posts
    6

    Re: Cut/Paste and Update Values between two sheets (losing rows)

    Hi, sorry if it took me long to answer,

    i've managed to fix this issue by calculating a new lastrow

    Please Login or Register  to view this content.
    and by splitting the file in several calculation steps.

    Many thanks,
    Picsou

  4. #4
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Cut/Paste and Update Values between two sheets (losing rows)

    Thanks for the feedback,
    regards, JLG

+ 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. Create Sheets, separate records, copy-paste cell values from master to created sheets
    By hishamezzat in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-19-2018, 05:31 PM
  2. [SOLVED] Update values on 1 sheet with values from multiple source sheets
    By Jean Claude Baptiste in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-04-2017, 04:56 PM
  3. Paste Special Values losing destination formatting
    By mr_newbie in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-07-2016, 08:36 AM
  4. Replies: 9
    Last Post: 05-27-2015, 06:28 AM
  5. Delete unwanted rows and update count of rows based on values
    By boddulus in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-12-2015, 08:34 PM
  6. Compare two sheets,copy and paste unique rows based on values in 2 columns
    By ooggiemobile in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-02-2013, 03:58 AM
  7. Replies: 7
    Last Post: 08-24-2012, 11:23 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