Reputation: 329
i want to make a macro that checks if the Date in Column A ist less then today. If so the macro should insert "done" in Column G.
Sub DoneCheck()
Dim rngZelle As Range, strText As String
With ActiveSheet
For Each c In Sheets("3. Umlagerungen").Range("A:A")
If c.Value < Int(Now) And Not (IsEmpty(c.Value)) Then c.Offset(0, 6).Value = "done"
Next c
End Sub
I know that it is very poorly coded but it works... The reason why I'm looking for help is because it runs really slow...
I tried it with Application.ScreenUpdating but it doesn't change anything.
Thank you in advance & greetings
Upvotes: 2
Views: 235
Reputation: 4514
You should only check the used cells in column A, and adding Application.ScreenUpdating = False
always helps speed things up:
Sub DoneCheck()
Dim eRow as long
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
eRow = Thisworkbook.Sheets("3. Umlagerungen").Cells(Rows.Count,1).End(xlUp).Row
For Each c In Thisworkbook.Sheets("3. Umlagerungen").Range("A2:A" & eRow)
If c.Value < Int(Now) And Not (IsEmpty(c.Value)) Then c.Offset(0, 6).Value = "done"
Next c
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
Upvotes: 3