Adding a row to the last row a specific section

  • I have done tons of searches on adding a row, which there are many, but have not found what I am looking for.

    I have a sheet broken into sections, such as: B4:B10-R4:R10 has data then the next section starts at B13:B19- R4:R10 with 2 blank lines in between.

    I have no problem find the last row of the sheet, but I cant seem to find the last row in the section. I have it set up so when I double click on the header cell for each section, it adds a row to the bottom of that specific section, which in this instance, is Row 11 and of course everything gets bumped down. Any help would be appreciated.

  • Re: Adding a row to the last row a specific section

    I got it to work finally. In Case anyone else needs this, here is the code:

    Dim FirstRow As Long, LastRow As Long
        Dim cCount As Long
    FirstRow = ActiveCell.Row
        LastRow = Range(ActiveCell, ActiveCell.End(xlDown)).Select
        Range(ActiveCell, ActiveCell.End(xlDown)).Select
             cCount = Selection.Count
        Range("B" & FirstRow + cCount - 1, "R" & FirstRow + cCount - 1).Select

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!