How to apply conditional formatting formula to large range faster

断了今生、忘了曾经 提交于 2019-12-02 08:40:07

Try turning off some Excel features before your code then turning them back on when it is done.

' turn off unnecessary excel features, put before your code
screenUpdateState = Application.ScreenUpdating
statusBarState = Application.DisplayStatusBar
calcState = Application.Calculation
eventsState = Application.EnableEvents
displayPageBreakState = ActiveSheet.DisplayPageBreaks
Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
ActiveSheet.DisplayPageBreaks = False

Then

' Turn features back on
Application.ScreenUpdating = screenUpdateState
Application.DisplayStatusBar = statusBarState
Application.Calculation = calcState
Application.EnableEvents = eventsState
ActiveSheet.DisplayPageBreaks = displayPageBreaksState

This didn't help me before, but I hope it help you as this link said :

This is particularly useful when condition is applied over a large range as performance can be slow in these cases.

ActiveSheet.EnableFormatConditionsCalculation = False

'.....

ActiveSheet.EnableFormatConditionsCalculation = True

Maybe this not work on MAC. ActiveSheet.EnableFormatConditionsCalculation Not Supported in VBA for Excel 2011 on the Mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!