I wrote down a macro which was use to run in less than 1 second. However, after an windows/Excel update the macro now takes 5 minutes to complete !
Could you please advice ?
Below my macro
Sub B_Palett_Weight_Check()
Dim ws As Worksheet
Dim Vws As Worksheet
Set Vws = ThisWorkbook.Sheets("Variables")
Sheets("Sheet1").Select
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
Application.PrintCommunication = False
ActiveSheet.DisplayPageBreaks = False
Application.DecimalSeparator = ","
Dim target As Variant
Dim r_AH As Range
Dim n As Long
Dim i As Long
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> "Variables" Then
' For the target value for each worksheet
target = Application.WorksheetFunction.VLookup(ws.Name, Vws.Range("A1:C10"), 2, False)
'Find the number of cells in column AH
n = ws.Range(ws.Range("AH3"), ws.Range("AH3").End(xlDown)).Rows.Count
Set r_AH = ws.Range("AH3")
For i = 1 To n
' Go down the column AH
If r_AH.Cells(i, 1).Value >= target Then
r_AH.Cells(i, 1).Interior.Color = vbRed
Else
r_AH.Cells(i, 1).Interior.Color = vbWhite
End If
Next i
End If
Next ws
End Sub