View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] gimme_this_gimme_that@yahoo.com is offline
external usenet poster
 
Posts: 129
Default Why doesn't this create a boxed range?

Adapted from the recorder. What must be changed to create a border box
around boxrng?

Thanks.

Sub t()
Dim startcell As Range, endcell As Range, boxrng As Range
Dim b As Workbook
Dim s As Worksheet
Set b = ActiveWorkbook
Set s = b.Sheets("Sheet1")


Set startcell = s.Cells(2, 2)
Set endcell = s.Cells(5, 5)
Set boxrng = Range(startcell, endcell)
boxrng.Borders(xlDiagonalDown).LineStyle = xlNone
boxrng.Borders(xlDiagonalUp).LineStyle = xlNone
boxrng.Borders(xlEdgeLeft).LineStyle = xlContinous
boxrng.Borders(xlEdgeTop).LineStyle = xlContinuous
boxrng.Borders(xlEdgeBottom).LineStyle = xlContinous
boxrng.Borders(xlEdgeRight).LineStyle = xlContinuous
boxrng.Borders(xlInsideVertical).LineStyle = xlNone
boxrng.Borders(xlInsideHorizontal).LineStyle = xlNone
End Sub