View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default Help required putting borders around cells.

try deleting the with statements of the INSIDEHORIZONTAL and INSIDEVERITICAL
borders that may still get you the results you want
delete
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With


"Centurian" wrote:




Ben,

I am having problems.

Ran the macro with the suggested alteration
and it halted at:

With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic


I got a Runtime 1004 Error
When debug was pressed
..LineStyle = xlContinuos
was hightlighted in yellow.


For your info, I am running version Excel 97
and the macro is called Sub Macro1()





ben wrote:
sheet1.usedrange.select

this will select every single used cell
then just add your border code to the bottom of that

"Centurian" wrote:


Can anyone help ?

I need to put border on a number of cells
of which number of rows is unknown.

The first routine below was originally used to find
the number of rows and then fill down the columns.

The 2nd part is a recording of keypresses to ut the
border on the cells.

HOW do I marry the two parts together in order to
put borders inside and around Range ("A3:F" & LastRows)



Dim LastRow As Long
With Worksheets("Sheet1")
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
.Range("B3").AutoFill Destination:=.Range("B3:B" & LastRow) _
, Type:=xlFillDefault

----------------------------------------------------------------


Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
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.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With



Regards
Centurian.