+ Reply to Thread
Results 1 to 9 of 9

Copied data not staying in same row

  1. #1
    Registered User
    Join Date
    06-26-2015
    Location
    Mid-West
    MS-Off Ver
    Office365
    Posts
    19

    Copied data not staying in same row

    Hello everyone.
    I have a sheet of data that I fill and clear repeatedly. I would like to capture some of that data to a log sheet to maintain a history.
    The attached spreadsheet functions 'almost' correctly.
    The problem I am having is; if any of the cells are empty in the data it messes up the rows in the log sheet.
    This is blender code, where I have taken code from multiple sources and tried to blend them together.

    Questions:
    How do I maintain row integrity when copying data to log sheet?
    What is the purpose of the "a" in this line of code? ""LR = .Range("a" & Rows.Count).End(xlUp).Row)"" It seems like I can change it without affecting anything in the macro.

    Functions:
    Macro -When I enter the desired date, It should copy some of the data from "existing" sheet to "ExistingLog" sheet, and maintain row integrity.

    Current Code:
    Please Login or Register  to view this content.
    I have attached a sample spreadsheet..

    Thanks
    tosteven
    Attached Files Attached Files
    Last edited by tosteven; 11-10-2015 at 11:46 AM. Reason: misspelling in subject

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copied data not stying in same row

    Not sure if this is what you mean, but try:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-26-2015
    Location
    Mid-West
    MS-Off Ver
    Office365
    Posts
    19

    Re: Copied data not stying in same row

    Thank you John for the quick response.
    I looks like the original code treats each column separately, if you enter 2/4/15 as the date in the original code, you can see the notes get offset in the log sheet.

    It does seem to maintain row integrity now, but it is filling the same row in the log sheet as the original, rather than the next available row. Leaving empty rows in the log sheet. Additionally if I change the data in the existing sheet it will overwrite data in the log sheet..

    -tosteven

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copied data not staying in same row

    I'm a bit confused. What do you mean by "row integrity"?

  5. #5
    Registered User
    Join Date
    06-26-2015
    Location
    Mid-West
    MS-Off Ver
    Office365
    Posts
    19

    Re: Copied data not staying in same row

    when the data copies to the new sheet.
    the data doesn't stay in the same row in the log sheet. because H5 is blank in the existing sheet, the data from H6 shifts up in the log sheet.
    so in the sample data if you use 2/4/15 as the date,
    data from existing A6, goes to Existing log A3. G6, goes to B3, F6 goes to C3; But H6 goes to D2 -because there is no data in existing H5.
    So column D in the log sheet ends up out of sync with the rest of the row.

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copied data not staying in same row

    Now I think, I understand. Will the Asset# always have data (ie Never be blank?).

  7. #7
    Registered User
    Join Date
    06-26-2015
    Location
    Mid-West
    MS-Off Ver
    Office365
    Posts
    19

    Re: Copied data not staying in same row

    yes, there will always be an asset number.
    though that number could get duplicated, if the machine comes back to be reissued.

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copied data not staying in same row

    Try:

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-26-2015
    Location
    Mid-West
    MS-Off Ver
    Office365
    Posts
    19

    Re: Copied data not staying in same row

    Thanks John.
    That appears to work perfectly.
    I appreciate your time on it.
    I can recognize that you have used the 'a' column to start the next row, great idea.
    I'll have to dissect and understand what the whole line is doing.

    Thanks a lot
    Tom

+ 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. Macro clears data from col A and B of the existing data when copied.
    By meseret in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-12-2015, 05:21 AM
  2. [SOLVED] When data is copied to another workbook, hyperlinks as not copied or they don't work
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-17-2014, 06:46 AM
  3. Trying to filter data and display it on another sheet, however the data isn't fully copied
    By patrickvdveen88 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2013, 12:54 PM
  4. [SOLVED] VBA copied chart keeps on pointing to original data, VBA relinking charts to nesource data
    By dastr in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-25-2013, 06:58 AM
  5. Copying multiple worksheet so that copied hyperlinks link to new copied sheets
    By chrisjames25 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-01-2013, 02:37 PM
  6. [SOLVED] Copying data adds carriage return to data copied
    By extrapulp in forum Excel General
    Replies: 2
    Last Post: 10-09-2012, 01:08 PM
  7. [SOLVED] can i convert data copied as an image into data in excel ?
    By prabhat in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-01-2005, 09: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