Grid Line

  • Thread starter Thread starter Ravi
  • Start date Start date
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
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top