Setting borders with a macro

O

orquidea

Hi

I recorded the below macro to set borders for each cell in a range. I just
think this macro could be shorter. I tried a few options buy they didn't
work. Could anyone help me to make it shorter.

Selection.CurrentRegion.Select


With Selection.borders(xlEdgeLeft)
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.borders(xlEdgeTop)
.Weight = xlThin
.ColorIndex = xlAutomatic

End With
With Selection.borders(xlEdgeBottom)

.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.borders(xlEdgeRight)

.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.borders(xlInsideVertical)

.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.borders(xlInsideHorizontal)

.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Thanks,

Orquidea
 
J

Jim Thomlinson

You could use just this one line for the whole thing...

Selection.Borders.Weight = xlThin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top