+ Reply to Thread
Results 1 to 8 of 8

copy a block of cells that can vary in rows and columns

  1. #1
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    copy a block of cells that can vary in rows and columns

    Dear all,

    I have attached a workbook as an example.
    From the sheet1 I need to copy a block of information. Some times the information has more rows or more columns. I would need to copy the last cell in a row and the last cell in a column to form a block that I can paste in another workbook.
    I can get the last used cell in a row and in a column, but can't figure out how to select the whole block of cells.
    Great would also be if there was a text in a cell (column B) and then start copying from there.
    Can one help out pleases?

    Greetings,
    megatronixs
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: copy a block of cells that can vary in rows and columns

    Hi,

    Your request is not clear to me. Would you manually add your desired output for a couple of differently sized example table so that we can see your end goal.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,213

    Re: copy a block of cells that can vary in rows and columns

    An example:

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: copy a block of cells that can vary in rows and columns

    How's this for you?

    Please Login or Register  to view this content.

  5. #5
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: copy a block of cells that can vary in rows and columns

    Check this out.
    Attached Files Attached Files
    Gary's Student

  6. #6
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: copy a block of cells that can vary in rows and columns

    Hi TMS,

    Thank you for a great macro. I just added a new sheet that will be more clear with what should be the end result.

    As you can see there is the first sheet that has some data. There are a few different blocks in it. What really needs to be done is that it should cut out the blocks and put them on a different sheet. Then they all should have the same title rows "My name....." "Text 1 Text2: Dummy text" and the last part of the "Note:......"
    (I kept the blocks in a color so you know what I mean with the blocks)
    in this case, it would take the second block, cut it out and put it on the second sheet with the title rows, then will go and cut out the third block and put it in the third sheet. All this until there are no more blocks and they all got their own sheet.
    I guess this is a difficult one, but can this be done?

    greetings,
    megatronixs
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: copy a block of cells that can vary in rows and columns

    Dear all,

    thank you for your great and quick answers. I hope I can find a working solution that will just do what I need and this also can be a help for others hopping to find similar things.

    Really, this is a great excel forum ;-)

  8. #8
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: copy a block of cells that can vary in rows and columns

    Hi,

    The following Macro is one way. It assumes that there are values in all of the cells in each of the blocks in row 3.

    Please Login or Register  to view this content.

+ 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