Thread: Border Formats
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Desert Piranha[_21_] Desert Piranha[_21_] is offline
external usenet poster
 
Posts: 1
Default Border Formats


Hi Tom,
If this works:

Sub abcd()
Range("C34:J42").BorderAround _
Weight:=xlMedium, ColorIndex:=3
End Sub

Then why won't this work?

Sub abcd()
With Selection.BorderAround _
Weight:=xlMedium, ColorIndex:=3
End With
End Sub

Tom Ogilvy Wrote:
Sub abcd()
Range("C34:J42").BorderAround _
Weight:=xlMedium, ColorIndex:=3

End Sub

--
Regards,
Tom Ogilvy


"Dave" wrote in message
...
Hi All
To format the outer borders of a selection, I use this code:

A = 3
Range("C34:J42").Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = A
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = A
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = A
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = A
End With

It's very cumbersome, but I have had no success trying to compac

it.
Is it possible to combine the 4 borders into a single statement, an

then
apply the 3 format lines just once?

Regards - Dave.



--
Desert Piranh

-----------------------------------------------------------------------
Desert Piranha's Profile: http://www.excelforum.com/member.php...fo&userid=2893
View this thread: http://www.excelforum.com/showthread.php?threadid=49477