I have a few macros saved into my Personal.xlsb file which work as expected. The problem is that when i close Excel and look in Task Manager there is still at least one Excel.exe running which gradually builds up in memory until it causes the whole system to slow down. Having googled around I tried removing the Personal.xlsb files from the XLStart folder and without this Excel opens, works and closes as expected.
The macro i suspect is causing the problem is this one, it is the only one I have run today or since the PC rebooted last but I am at a loss to figure out what is happening?
Any help anyone could give would be very gratefully received
The macro i suspect is causing the problem is this one, it is the only one I have run today or since the PC rebooted last but I am at a loss to figure out what is happening?
Code:
Sub avail231()'
' 231Availability Report
'
'
'
Dim sSheetName As String
Dim sDataRange As String
sSheetName = ActiveSheet.Name
sDataRange = Selection.Address
strActiveWorkSheet = ActiveSheet.Name
Cells.Select
Columns.AutoFit
Cells(1, 1).Select
Dim rangeTemp As Range
Set rngTemp = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious)
If Not rngTemp Is Nothing Then
Range(Cells(1, 1), rngTemp).Select
End If
Range("A1").Select
'1ST level SORT ON NAME COL A
'2ND level SORT ON START DATE COL B
'3RD levle SORT ON END DATE COL C
Sheets(sSheetName).Range("a1:u" & Sheets(sSheetName).Range("a1").End(xlDown).Row).Sort _
key1:=Sheets(sSheetName).Range("D:D"), order1:=xlAscending, _
key2:=Sheets(sSheetName).Range("B:B"), order2:=xlAscending, _
Header:=xlYes
' Range("A1").Select
' Selection.AutoFilter
' ActiveSheet.Range("A:U").AutoFilter Field:=4, Criteria1:="BR50"
' ActiveSheet.Range("A:U").AutoFilter Field:=6, Criteria1:="0"
' ActiveSheet.Range("A:U").AutoFilter Field:=8, Criteria1:="1"
' Selection.SpecialCells(xlCellTypeVisible).Select
' Application.DisplayAlerts = False
' ActiveSheet.UsedRange.Offset(1, 0).Resize(ActiveSheet.UsedRange.Rows.Count - 1).Rows.Delete
' Application.DisplayAlerts = True
'ActiveSheet.ShowAllData
Range("A1").Select
Selection.AutoFilter
ActiveSheet.Range("A:U").AutoFilter Field:=4, Criteria1:="KL20"
ActiveSheet.Range("A:U").AutoFilter Field:=2, Criteria1:=Array("EX/CLAMP", "EX/GSKT", "EX/MTG", "EX/TUBIN"), Operator:=xlFilterValues
Selection.SpecialCells(xlCellTypeVisible).Select
Application.DisplayAlerts = False
ActiveSheet.UsedRange.Offset(1, 0).Resize(ActiveSheet.UsedRange.Rows.Count - 1).Rows.Delete
Application.DisplayAlerts = True
ActiveSheet.ShowAllData
Range("A1").Select
Selection.AutoFilter
ActiveSheet.Range("A:U").AutoFilter Field:=1, Criteria1:=Array("CLUTCH/CAR", "EXHAUSTS", "ROTATE", "T/MISSION"), Operator:=xlFilterValues
ActiveSheet.Range("A:U").AutoFilter Field:=6, Criteria1:="0"
ActiveSheet.Range("A:U").AutoFilter Field:=8, Criteria1:="1"
Selection.SpecialCells(xlCellTypeVisible).Select
Application.DisplayAlerts = False
ActiveSheet.UsedRange.Offset(1, 0).Resize(ActiveSheet.UsedRange.Rows.Count - 1).Rows.Delete
Application.DisplayAlerts = True
ActiveSheet.ShowAllData
If ActiveSheet.AutoFilterMode Then ActiveSheet.AutoFilterMode = False
Range("A1").Select
End Sub
Any help anyone could give would be very gratefully received