![]() |
Neverending lines.
I get spreadsheets emailed to me from other people sometimes and they will
sometimes include cells that have borders around them that go on forever. I know how to set my print area to keep the lines from printing endlessly, but how do Ijust get rid of them. Deleting them repeatedly doesn't work because they go on forever. |
Neverending lines.
you could click at the junction of the row and column headers so the entire
worksheet is selected, then do Format=Cells, go to the border tab and unclick any borders. for code: Sub RemoveBorders() With ActiveSheet.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 End With End Sub -- Regards, Tom Ogilvy "Janie" wrote: I get spreadsheets emailed to me from other people sometimes and they will sometimes include cells that have borders around them that go on forever. I know how to set my print area to keep the lines from printing endlessly, but how do Ijust get rid of them. Deleting them repeatedly doesn't work because they go on forever. |
Neverending lines.
This a general purpose tidying macro that may help you
Sub OptimizeWorkbook() Dim ws As Worksheet Dim lastrow As Long, lastcol As Long Application.ScreenUpdating = False On Error Resume Next For Each ws In ActiveWorkbook.Worksheets With ws lastrow = .Cells.Find(what:="*", after:=.Range("A1"), LookIn:=xlValues, lookat:=xlPart, searchorder:=xlByRows, searchdirection:=xlPrevious).Row lastcol = .Cells.Find(what:="*", after:=.Range("A1"), LookIn:=xlValues, lookat:=xlPart, searchorder:=xlByColumns, searchdirection:=xlPrevious).Column Range(.Cells(1, lastcol + 1), .Cells(65536, 256)).Delete Range(.Cells(lastrow + 1, 1), .Cells(65536, 256)).Delete lastrow = .UsedRange.Rows.Count End With Next ws On Error GoTo 0 Application.ScreenUpdating = True End Sub |
Neverending lines.
How can I email this spreadsheet to you? I do not think that I am explaining
my dilemma very well. "Janie" wrote: I get spreadsheets emailed to me from other people sometimes and they will sometimes include cells that have borders around them that go on forever. I know how to set my print area to keep the lines from printing endlessly, but how do Ijust get rid of them. Deleting them repeatedly doesn't work because they go on forever. |
Neverending lines.
|
All times are GMT +1. The time now is 05:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com