Removing Border lines and colour for All sheets

J

James

Hi Everyone,

is it possible to write a macro to run every sheet and just remove
border lines and colours for all cells in a sheet for every sheets in
a workbook?

I know macro is like this but can't really think how I can loop this.

Can anyone help?


Thanks alot


Cells.Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Selection.Interior.ColorIndex = xlNone
 
G

Gary Keramidas

just to add to your code

Sub remove_Borders()
Dim ws As Worksheet

For Each ws In ThisWorkbook.Worksheets
With ws.Cells
.Borders(xlDiagonalDown).LineStyle = xlNone
.Borders(xlDiagonalUp).LineStyle = xlNone
.Borders(xlEdgeLeft).LineStyle = xlNone
.Borders(xlEdgeTop).LineStyle = xlNone
.Borders(xlEdgeBottom).LineStyle = xlNone
.Borders(xlEdgeRight).LineStyle = xlNone
.Borders(xlInsideVertical).LineStyle = xlNone
.Borders(xlInsideHorizontal).LineStyle = xlNone
.Interior.ColorIndex = xlNone
End With
Next
End Sub
 
R

Rick Rothstein

I think the code can be shorted to this...

Sub Remove_Borders()
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
With WS.Cells
.Borders.LineStyle = xlNone
.Borders(xlDiagonalDown).LineStyle = xlNone
.Borders(xlDiagonalUp).LineStyle = xlNone
.Interior.ColorIndex = xlNone
End With
Next
End Sub
 
J

James

I think the code can be shorted to this...

Sub Remove_Borders()
  Dim WS As Worksheet
  For Each WS In ThisWorkbook.Worksheets
    With WS.Cells
      .Borders.LineStyle = xlNone
      .Borders(xlDiagonalDown).LineStyle = xlNone
      .Borders(xlDiagonalUp).LineStyle = xlNone
      .Interior.ColorIndex = xlNone
    End With
  Next
End Sub

--
Rick (MVP - Excel)

"Gary Keramidas" <GKeramidasAtMSN.com> wrote in message








- Show quoted text -

thanks alot everyone
 

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

Top