user3790788
user3790788

Reputation: 53

Removing bottom borders for a range of cells

I have a very simply problem which hopefully has a very simple solution. I am trying to create a macro to remove only the bottom borders of a range of cells. However, if I do something like

Range("D21:I28").Borders(xlEdgeBottom).Linestyle = xlNone

It only removes the bottom border of the lowest row of cells. Is there a way to do this for each cell? I do not want to use a for loop because it's slow and you can see each individual cell's borders getting erased - I want to make it instantaneous.

Upvotes: 1

Views: 3975

Answers (1)

Gary's Student
Gary's Student

Reputation: 96753

Reconsider your decision and use a loop:

Sub UseALoop()
    Application.ScreenUpdating = False
    For Each r In Range("D21:I28")
        r.Borders(xlEdgeBottom).LineStyle = xlNone
    Next r
    Application.ScreenUpdating = True
End Sub

Upvotes: 2

Related Questions