+ Reply to Thread
Results 1 to 5 of 5

How to merge last blank rows

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-11-2009
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    517

    How to merge last blank rows

    Hi, can anyone please help me with a code where after last blank row, B to G is merged. Thanks

    tries this but still no luck

    .Range("B" & Range("G" & Rows.Count).End(xlUp).Offset(2, 0)).Select
    Selection.Merge
    Last edited by biznez; 08-13-2015 at 11:33 AM.

  2. #2
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: How to merge last blank rows

    One way,
    Sub test()
    
        Dim LR As Long
    
        With Columns("B:G")
            LR = .Find("*", , , , xlByRows, xlPrevious).Row    'last non-empty row within col. B to G
            .Rows(LR + 1).Merge    'merge cells on row LR+1 within these columns
        End With
    
    End Sub

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

    Re: How to merge last blank rows

    Maybe:

    Sub biznez()
    Dim x As Long, y As Long
    x = Cells(Rows.Count, "B").End(3)(2).row
    Range(Cells(x, "B"), Cells(x, "G")).Merge
    End Sub

  4. #4
    Forum Contributor
    Join Date
    12-11-2009
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    517

    Re: How to merge last blank rows

    Thanks guys, both worked great!

  5. #5
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: How to merge last blank rows

    You're welcome, and thanks for the rep

+ 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. Replies: 11
    Last Post: 07-30-2015, 12:35 PM
  2. [SOLVED] insert blank rows every nth row and copy down data to fill blank rows
    By surpass in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-06-2014, 02:55 PM
  3. Replies: 2
    Last Post: 09-18-2014, 12:20 PM
  4. Replies: 2
    Last Post: 01-22-2014, 02:35 PM
  5. How to create a macro to insert blank rows and copy data into blank rows?
    By zodiack101 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-29-2013, 01:18 PM
  6. Merge Duplicate Rows unique values into single rows for an infinite amount of columns/rows
    By aimeecrystalaid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-21-2013, 08:43 PM
  7. Merge two rows into one, then merge into mailer?
    By tavat in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-24-2006, 02:55 PM

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