Results 1 to 2 of 2

Keep last row format/values when transposing values from one worksheet to another

Threaded View

BuzzOffSweetheart Keep last row format/values... 06-18-2012, 11:34 AM
BuzzOffSweetheart Re: Keep last row... 06-18-2012, 02:27 PM
  1. #1
    Registered User
    Join Date
    02-27-2009
    Location
    Houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    25

    Keep last row format/values when transposing values from one worksheet to another

    Hi All,

    I have a spreadsheet that gets generated from a database.. What i am trying to do is add to my macro a way to paste above value/formats from DESTINATION worksheet..

    In my current workbook, it has various columns:

    6-18-2012 10-22-09 AM.png

    SOME of these columns get transferred to another worksheet for end user input via Macro1.

    Code example:
    .Cells(18, 4).Value = Sheets("ORIG").Cells(26, 13).Value 'Net Weight
            .Cells(18, 5).Value = Sheets("ORIG").Cells(26, 15).Value 'RN Weight Unit
            .Cells(18, 7).Value = Sheets("ORIG").Cells(26, 12).Value 'Gross Weight
            .Cells(18, 8).Value = Sheets("ORIG").Cells(26, 15).Value 'RN Weight Unit
            .Cells(18, 11).Value = Sheets("ORIG").Cells(26, 6).Value 'X Dim
            .Cells(18, 12).Value = Sheets("ORIG").Cells(26, 9).Value 'Dim Unit
            .Cells(18, 14).Value = Sheets("ORIG").Cells(26, 7).Value 'Y Dim
    Then after the data is manually modified (new rows added) on the new worksheet, there is a macro2 that takes those values and pastes them back to the original sheet..

    Code Example:
    Sheets("ORIG").Cells(nRowDetail + 1, 1).Value = Sheets("NEW").Cells(10, 19).Value   'Packing Number
             Sheets("ORIG").Cells(nRowDetail + 1, 2).Value = Sheets("NEW").Cells(14, 17).Value   'Packing type
             Sheets("ORIG").Cells(nRowDetail + 1, 13).Value = Sheets("NEW").Cells(18, 4).Value   'Net Weight
             Sheets("ORIG").Cells(nRowDetail + 1, 15).Value = Sheets("NEW").Cells(18, 5).Value   'RN Weight Unit
             Sheets("ORIG").Cells(nRowDetail + 1, 12).Value = Sheets("NEW").Cells(18, 7).Value   'Gross Weight
             Sheets("ORIG").Cells(nRowDetail + 1, 15).Value = Sheets("NEW").Cells(18, 8).Value   'RN Weight Unit
    The problem I am having is, if the end user adds more rows, those rows do not get the format the rest of the worksheet has, nor does it get any values that i did not transfer with the original macro1.

    6-18-2012 10-25-32 AM.png

    if you look at the last two lines on the above picture - those are the new lines, that only copy, of course what is on the NEW sheet - I need to grab the colour/formats/values(if blank) from the line above after it is pasted..

    I want the macro2 to take the values and paste them, but if the value is blank, then grab the previous value from the sheet it is pasted unto, as well as grabbing the format from the above line on the sheet it is pasted into (text format, interior colour/background colour)..

    Does this make sense? Is there any way to do this via my vb code in Macro2?
    Last edited by BuzzOffSweetheart; 06-18-2012 at 12:58 PM. Reason: Clarified in hopes of getting an answer!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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