'How to quickly copy and paste conditional formatting in Excel using C#
In my application, I need to copy user defined formatting from one range of cells over to another. To do this I select the range where the formatting is defined, copy it to clipboard, select target range and then use the following function to do apply the formatting:
PasteSpecial(Excel.XlPasteType.xlPasteFormats, Excel.XlPasteSpecialOperation.xlPasteSpecialOperationNone, false, false);
This works well unless the source range contains conditional formatting. If the target range is large (thousands of rows), the users may need to wait about 30s (this depends on how large is the target range) for the formatting to be applied. When there is no conditional formatting, PasteSpecial completes almost instantaneously.
I have the following settings set:
Calculation = manual
ScreenUpdating = false
EnableEvents = false
DisplayStatusBar = false
PrintCommunication = false
DisplayAlerts = false
Are there any faster ways to apply formatting besides using clipboard and PasteSpecial?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
