View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default getting rid of selection for formatting

borderaround

--
Don Guillett
SalesAid Software

"Arnold Klapheck" wrote in
message ...
I have been given code that seems repetative, was trying to figure out a
way
to shorten it up and make more efficient. is there a way to refer to the
borders with one command. I was thinking of doing with within
with
statements as follows

[***My Thoughts***]
With Range(A1:AQ1")
With .borders(xlEdgeLeft,wlEdgeTop, ..etc)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Font
.Name = "Arial"
.Size = 8
.Bold = False
.ColorIndex = xlAutomatic
End With
End With

[***The Code I need to modify***]
Range("A1:AQ1").Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection
.NumberFormat = "General"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With
With Selection.Font
.Name = "Arial"
.Size = 8
.Bold = False
.ColorIndex = xlAutomatic
End With
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
End With