Hi,
When running the following, the sheet runs through the first time no problem as there is no data, once data is in the sheet this then takes forever to clear, i have tried usedrange and selection a smaller range manually, neither makes a difference, i have also tried this with just one sheet which is also the same.
Soon as i remove this code it works fine. Why does this keep happening ?
The rest of the sheet is at present
When running the following, the sheet runs through the first time no problem as there is no data, once data is in the sheet this then takes forever to clear, i have tried usedrange and selection a smaller range manually, neither makes a difference, i have also tried this with just one sheet which is also the same.
Soon as i remove this code it works fine. Why does this keep happening ?
VBA Code:
Application.EnableEvents = False
Application.Calculation = xlManual
For N = 1 To 9
With wb.Sheets("Day" & N)
If .AutoFilterMode = True Then .AutoFilterMode = False
Range("A1:G25000").Clear
End With
Next
Application.Calculation = xlAutomatic
Application.EnableEvents = True
The rest of the sheet is at present
VBA Code:
With Workbooks(CopyFile).Sheets(CopyFileName).UsedRange
.AutoFilter Field:=1, Criteria1:="<>" & MyCriteria
.Offset(1).SpecialCells(xlCellTypeVisible).EntireRow.Delete
.AutoFilter
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
End With
For N = 1 To 9
With wb.Sheets("Day" & N)
.Activate
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End With
Next
Application.CutCopyMode = False
Workbooks(CopyFile).Close savechanges:=False