Z
Zen
Hi,
I'm running a macro to rearrange some tables and add alternate row colors.
In the past this macro only took about 15 seconds to run and now it takes
several minutes. I can't recall installing any new apps besides windows
updates in a long time.
I didn't look at cpu usage before since it was so fast I didn't think
anything of it, but now it is like 40-50% in the process list.
kind of an old system but still workin hard.
Win XP with excel 2002
dual 1.8ghz xeon
1gb ram
I've copy/pasted the macro.
Sub Inventory()
'
' Inventory Macro
' Stip "The" from titles and rearrange
'
'
Columns("E:F").Select
Selection.Delete Shift:=xlToLeft
Columns("B:B").Select
Selection.Cut
Columns("E:E").Select
ActiveSheet.Paste
Range("B1").Select
Application.WindowState = xlNormal
Range("B1").Select
Range("B2").Select
ActiveCell.FormulaR1C1 = ""
Range("B1").Select
ActiveCell.FormulaR1C1 = "=IF(LEFT(RC[3],4)=""The
"",MID(RC[3],5,255),RC[3])"
Range("B1").Select
Selection.Copy
Range("B2").Select
ActiveWindow.SmallScroll Down:=75
Range("B2:B79").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll Down:=-42
Rows("1:1").Select
Selection.Font.Bold = True
ActiveWindow.WindowState = xlMaximized
Columns("B:B").Select
Selection.ColumnWidth = 28.86
Application.WindowState = xlMaximized
ActiveWindow.WindowState = xlNormal
ActiveWindow.WindowState = xlMaximized
ActiveWindow.WindowState = xlNormal
With ActiveWindow
.Top = 1.75
.Left = 1.75
End With
With ActiveWindow
.Width = 843.75
.Height = 320.25
End With
Columns("A:A").ColumnWidth = 10.57
Selection.ColumnWidth = 75.86
Range("A3").Select
Columns("A:A").ColumnWidth = 11.43
Columns("C:C").ColumnWidth = 14.86
Columns("D").Select
Selection.ClearContents
Range("D12").Select
Cells.Select
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 300
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
Cells.Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=MOD(ROW(),2)"
Selection.FormatConditions(1).Interior.ColorIndex = 24
End Sub
I'm running a macro to rearrange some tables and add alternate row colors.
In the past this macro only took about 15 seconds to run and now it takes
several minutes. I can't recall installing any new apps besides windows
updates in a long time.
I didn't look at cpu usage before since it was so fast I didn't think
anything of it, but now it is like 40-50% in the process list.
kind of an old system but still workin hard.
Win XP with excel 2002
dual 1.8ghz xeon
1gb ram
I've copy/pasted the macro.
Sub Inventory()
'
' Inventory Macro
' Stip "The" from titles and rearrange
'
'
Columns("E:F").Select
Selection.Delete Shift:=xlToLeft
Columns("B:B").Select
Selection.Cut
Columns("E:E").Select
ActiveSheet.Paste
Range("B1").Select
Application.WindowState = xlNormal
Range("B1").Select
Range("B2").Select
ActiveCell.FormulaR1C1 = ""
Range("B1").Select
ActiveCell.FormulaR1C1 = "=IF(LEFT(RC[3],4)=""The
"",MID(RC[3],5,255),RC[3])"
Range("B1").Select
Selection.Copy
Range("B2").Select
ActiveWindow.SmallScroll Down:=75
Range("B2:B79").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll Down:=-42
Rows("1:1").Select
Selection.Font.Bold = True
ActiveWindow.WindowState = xlMaximized
Columns("B:B").Select
Selection.ColumnWidth = 28.86
Application.WindowState = xlMaximized
ActiveWindow.WindowState = xlNormal
ActiveWindow.WindowState = xlMaximized
ActiveWindow.WindowState = xlNormal
With ActiveWindow
.Top = 1.75
.Left = 1.75
End With
With ActiveWindow
.Width = 843.75
.Height = 320.25
End With
Columns("A:A").ColumnWidth = 10.57
Selection.ColumnWidth = 75.86
Range("A3").Select
Columns("A:A").ColumnWidth = 11.43
Columns("C:C").ColumnWidth = 14.86
Columns("D").Select
Selection.ClearContents
Range("D12").Select
Cells.Select
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 300
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
Cells.Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=MOD(ROW(),2)"
Selection.FormatConditions(1).Interior.ColorIndex = 24
End Sub