Border Last Range Of Cells

  • Hi,


    I am trying to have a border drawn around a group of cells. This group of cells changes per list I make, but only the height changes. The width is always the same (from column A to column J) and the top is always at row 5. Only the last row changes. How can a border be drawn around this group of cells no matter the size of the group of cells? Below is the macro I have written so far.


    This line of code does not work

    Code
    Range("A5:J" & lastrow1).BorderAround.Weight = xlThin


    and I can't come up with an answer that does work.


    Any help is much appreciated!


    Cheers, Tom

  • Re: Bordering A Changing Group Of Cells


    Try avoid selecting. Below suggestions to avoid selecting and amend code for border


    Code
    Dim LastRow1 As Long
    LastRow1 = Cells(Rows.Count, "A").End(xlUp).Row
    Range("A5:J" & LastRow1).BorderAround _
    Weight:=xlThin



    VBA Noob

  • Re: Bordering A Changing Group Of Cells


    Thanks VBA Noob, that works really well! BorderAround is an excellent command!


    Cheers, Tom

Participate now!

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