View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default controlling cell borders in excel using VB

Sub AddBorders()
With Range("A8").CurrentRegion
.Borders(xlDiagonalDown).LineStyle = xlNone
.Borders(xlDiagonalUp).LineStyle = xlNone
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End With
End Sub

--
Regards,
Tom Ogilvy


eli silverman wrote in message
...
I hve a VB application that is using the copyfromrecordset
function to transfer the an ADODB recordset to an excel
file starting in cell A8 filling the range ("A8":"Z37")
"Z37" varies depending on the query being executed. The
resulting range could be anywhere from ("A8":"D9") to
("A8":"BZ1200")
I would like to set the border to "all borders" just for
the specified range. Can anyone explain how this can be
acomplished?
Any help would be greatly appreciated