+ Reply to Thread
Results 1 to 5 of 5

Copy and Paste from previous Row

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Copy and Paste from previous Row

    Please refer to attached excel sheet...

    I need a VBA Macro to do the following:

    Column B, C and D have data..
    Some rows have missing data in Column B and C.
    I need those cell filled with previous rows data until next filled data is reached.

    Example:

    Cell B45 thru C65 should be filled with same data as in B44:C45
    Cell B67 thru C 82 should be filled with same data as in B66:C66
    .
    .
    .
    Cell B252 thru C252 should be filled with same data as in B251:C251
    .
    .
    and so on until all done....

    Please refer to original and Manually done sheet for understanding..

    Let me know if you have any questions..

    Thank you,

    Riz Momin
    Attached Files Attached Files
    Last edited by rizmomin; 06-14-2008 at 03:03 PM.

  2. #2
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845
    Hi,

    Paste the following code to a module.

    Please Login or Register  to view this content.
    Charles

    There are other ways to do this, this is but 1 !
    Be Sure you thank those who helped.
    IF YOU'RE SATISFIED BY ANY MEMBERS RESPONSE TO YOUR ISSUE PLEASE USE THE STAR ICON AT THE BOTTOM LEFT OF THE POST UNDER THEIR NAME.

  3. #3
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    hi Riz,

    This can be done quite quickly without a macro by following the below steps:

    - select the used range that requires fixing
    - press [F5], "Special"
    - choose "Blanks", [ok]
    - type "=" & press the [up arrow]
    - press [ctrl + enter]
    This will leave the cells containing formulae.


    The below macro uses the same approach but also converts the formulae to values:

    Please Login or Register  to view this content.
    If your selected range is likely to have more than 8192 non-contiguous cells you'll need to modify the macro slightly...



    hth
    Rob

    edit: added code tags
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

  4. #4
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Smile

    Thanks a lot!!!

    First one would work great...

    Riz Momin

  5. #5
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    Pleased we could help - thanks for the feedback :-)

    Rob

+ Reply to Thread

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