I've been writing a macro which inserts a new row in a holiday sheet for a new recruit, now it was working fine, but now it has ground to a halt and takes a huge amount of time to insert a new row. Here is the affected code:
For f = 1 To Worksheets.Count - 1
Worksheets(f).Select
Range("A1").Select
If Worksheets(f).Name = "FLEXI" Then
Range("A1").Select
N = Range("A2").Value
Range("A" & NewRow).Select
Selection.EntireRow.Insert
Range("A" & NewRow + N + 1).Select
Selection.EntireRow.Insert
GoTo flexidivert
End If
Range("A" & NewRow).Select
Selection.EntireRow.Insert
flexidivert:
Next f
I have screenupdating disabled, enableevents disabled and calculations set to manual so the usual suspects aren't at work here. It's such a simple procedure as well, I can't understand why it takes minutes to compute. NewRow is the row to be pasted in and worksheets.count = 5 so there aren't a huge number to scroll through.