Excel Constant for Border All Around Cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi.

I'm creating headings dynamically in Excel and am placing a border around
each cell as it's created.
I'd like to be able to border a cell with just 1 Excel constant instead of
having to use 4 - one for each side. Since adding borders, the program has
slowed down considerably. Is there a more efficient way than the one I'm
using now?

'*** Put a border around the heading just added
wshFIC.Cells(iHeadingLine, lLastColumn).Select
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
End With
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
End With

'*** Change the font for just this cell
With Selection.Font
.Name = "Arial Narrow"
.Bold = True
.Size = 9
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Interior.ColorIndex = 37
End With

TIA.
Rita
 
Nope there is not one constant for all four sides. The constants are

xlDiagonalDown, xlDiagonalUp, xlEdgeBottom, xlEdgeLeft, xlEdgeRight,
xlEdgeTop, xlInsideHorizontal, or xlInsideVertical

HTH
 
Pity. Thanks for your response.

Jim Thomlinson said:
Nope there is not one constant for all four sides. The constants are

xlDiagonalDown, xlDiagonalUp, xlEdgeBottom, xlEdgeLeft, xlEdgeRight,
xlEdgeTop, xlInsideHorizontal, or xlInsideVertical

HTH
 
Rita, this line will fix you right up :)

Selection.BorderAround xlContinuous, xlThin

-Jack
 

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

Back
Top