Have to keep hitting the Continue Button
You should be able to simplify your code a lot: that may help, but there is nothing obviously "wrong" here.
Tim
Sub Cleanup_Report()
With ActiveSheet
.Range("A1:A9").EntireRow.Delete
With .UsedRange
.WrapText = False
.MergeCells = False
End With
.Range("C1:D1,F1:Z1").EntireColumn.Delete 'check this!
.Columns("A:E").Sort Key1:=Range("D2"), Order1:=xlAscending, _
Key2:=Range("C2"), Order2:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal
.Columns("A:M").EntireColumn.AutoFit
.UsedRange.EntireRow.AutoFit
With .Range("A1").CurrentRegion
.Borders.LineStyle = xlContinuous
.Borders.Weight = xlThin
.Borders.ColorIndex = xlAutomatic
.Borders(xlDiagonalDown).LineStyle = xlNone
.Borders(xlDiagonalUp).LineStyle = xlNone
End With
End With
End Sub
"Seth Dunayer" wrote in message ...
The message is "Code execution has been interrupted". The message
usually appears first at the line that reads ".WrapText = False".
Thanks for your help,
Seth
The code is...
Option Explicit
Sub Cleanup_Report()
Range("A1:J9").EntireRow.Delete
Cells.Select
With Selection
.WrapText = False
.MergeCells = False
End With
Columns("A:M").Select
Columns("A:M").EntireColumn.AutoFit
Range("C1").Select
Selection.EntireColumn.Delete
Selection.EntireColumn.Delete
Range("D1").Select
Selection.EntireColumn.Delete
Selection.EntireColumn.Delete
Range("F1:Z1").Select
Selection.EntireColumn.Delete
Selection.EntireColumn.Delete
Columns("A:E").Select
Selection.Sort Key1:=Range("D2"), Order1:=xlAscending,
Key2:=Range("C2") _
, Order2:=xlAscending, Header:=xlYes, OrderCustom:=1,
MatchCase:=False _
, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2:= _
xlSortNormal
Cells.Select
Cells.EntireRow.AutoFit
Range("A1").Select
Selection.CurrentRegion.Select
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
Range("A1").Select
End Sub
Tim Williams wrote:
Show the code.
Tim
wrote in message oups.com...
I wrote a very simple Macro and when it runs on my PC it runs with no
problem. On a coworkers PC it stops several times and I have to hit
the continue button until it eventually finishes. Any idea why this
happens or a possible solution.
Thanks.
|