Grid Line

R

Ravi

Hi,
While running a macro in a new worksheet for grid line an error occured and
while debugging " .LineStyle = xlContinuous "

Thanks in advance
Ravi Kumar
 
R

Ravi

here is the code

Sub line()
'
' line Macro
' Macro recorded 7/23/2008 by ravikumart
'
' Keyboard Shortcut: Ctrl+Shift+W
'
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
End Sub
 
D

Don Guillett

It appears you didn't have enough code doing it that way. Try this. If you
don't want the border around simply comment it out or remove the line.

Sub DoBorders()
With Selection
.Borders.LineStyle = xlContinuous
.BorderAround Weight:=xlMedium
End With
End Sub
 
Top