How to Fix broken Conditional Formatting Rules with VBA

  Рет қаралды 2,902

Celia Alves - Solve & Excel

Celia Alves - Solve & Excel

Күн бұрын

Conditional Formatting Rules can easily be disrupted. The same thing happens with Data validation ranges. Part of the solution is to use Excel Tables, if possible. Then, use VBA to make sure the rules are fixed every time you save the file.
See blog post about this topic:
solveandexcel....
--------------------------------------------------------
UPDATES TO THE CODE:
Add the following line of code to ensure that Data Validation rules are also preserved:
Selection.PasteSpecial xlPasteValidation
Derek Prince's contribution in the comments:
I mentioned that the template (worksheet CondFormat) would be hidden to prevent other users from accidentally corrupting the format. However, when we do that, we will also need to modify your macro to first Unhide this sheet, copy the format, apply it to the Data worksheet, and then Hide the template again. You can, of course, use "Application.ScreenUpdating = False" to hide these worksheet manipulations.
------------------------------------------------------------
Mackenzie Cook’s KZbin Channel - / @djangoflyfar2633
Icons made by Alfredo Hernandez - www.flaticon.c... from FlatIcon - www.flaticon.com
If you need to contact me: solveandexcel.ca/

Пікірлер: 15
@pickleball_dereck
@pickleball_dereck 6 жыл бұрын
Much appreciated, Celia. You correctly mentioned that the template (worksheet CondFormat) would be hidden to prevent other users from accidentally corrupting the format. However, when you do that, you will also need to modify your macro to first Unhide this sheet, copy the format, apply it to the Data worksheet, and then Hide the template again. You can, of course, use "Application.ScreenUpdating = False" to hide these worksheet maniuplations. Thanks for sharing!
@faisalakbaradin6352
@faisalakbaradin6352 Жыл бұрын
Thank you so much Ms. Celia, this really helps my work!
@CeliaAlvesSolveExcel
@CeliaAlvesSolveExcel Жыл бұрын
Awesome, Faisal! Happy to help and thank you for leaving your feedback. Please check additional tip in the video description.
@GuiadoExcelOficial
@GuiadoExcelOficial 6 жыл бұрын
Parabéns pela solução, realmente interessante copiar os formatos á partir de uma tabela pré-formatada, realmente facilita e reduz a complexidade do código fonte. Ajustar também ao salvar foi uma boa sacada. Forte abraço Marcos Rieper
@CeliaAlvesSolveExcel
@CeliaAlvesSolveExcel 2 жыл бұрын
Obrigada, Marcos! Esse comentario vale muito, e vindo de voce ainda vale mais. Abraco.
@OzduSoleilDATA
@OzduSoleilDATA 6 жыл бұрын
WOW! This is a serious concern to address and a nice solution. These kinds of problems are scary because users often don't know just how fragile conditional formatting and dropdown lists can be.
@juliennadon4134
@juliennadon4134 3 ай бұрын
This is amazing, I've spent countless hours trying to fix this problem. Thank you so much!
@CeliaAlvesSolveExcel
@CeliaAlvesSolveExcel 3 ай бұрын
You're very welcome! Glad that it helped and thank you for stopping by.
@patricknicholson5556
@patricknicholson5556 10 ай бұрын
Where can I get the VBA code?
@CeliaAlvesSolveExcel
@CeliaAlvesSolveExcel 10 ай бұрын
For this one, you'll have to follow the video and type the code as you watch. Please check one update for the code on the video description.
@briantwitchell
@briantwitchell Жыл бұрын
Does the macro add a new set of rules to the sheet every time you update it? I am having a related but different issue. I have a sheet that has new lines being added all the time, and every time they are, a new set of rules is being added to the spreadsheet and we are in the 100s by now. Can you write a macro that calculates the number of rows and then edits each rule to extend them to the entire sheet?
@CeliaAlvesSolveExcel
@CeliaAlvesSolveExcel Жыл бұрын
Hi, Brian. This macro removes all the rules (to remove rule duplicates) and reinstates them. I suggest you follow the video. You can also check the blog post on my website about the same topic. See video description.
@morilia1669
@morilia1669 6 жыл бұрын
Ola Célia, bom dia! Eu vim do canal da Vivi e já me inscrevi em seu canal. Eu sou um apaixonado por Excel, pena que não entendo Inglês mas vou tentar ver se aprendo um pouco.
@blade12
@blade12 4 жыл бұрын
This would have been very useful for me, but my spreadsheet has merged cells that the format painter breaks
@CeliaAlvesSolveExcel
@CeliaAlvesSolveExcel 4 жыл бұрын
Merged cells are the worst! See if you can use Horizontal Alignment "center across selection" instead.
How to combine in a folder multiple files with different column headers - T0030
31:13
Celia Alves - Solve & Excel
Рет қаралды 34 М.
Excel VBA Tip - Stop Selecting Cells!
15:39
TeachExcel
Рет қаралды 18 М.
The joker favorite#joker  #shorts
00:15
Untitled Joker
Рет қаралды 30 МЛН
Шок. Никокадо Авокадо похудел на 110 кг
00:44
Spongebob ate Michael Jackson 😱 #meme #spongebob #gmod
00:14
Mr. LoLo
Рет қаралды 9 МЛН
Excel VBA IF THEN Statement (with ELSEIF & Looping in cells)
12:10
Leila Gharani
Рет қаралды 318 М.
How to Fix Excel Conditional Formatting Duplicated Rules
3:10
Contextures Inc.
Рет қаралды 40 М.
Learn Excel VBA to Automate Anything
14:02
Kenji Explains
Рет қаралды 439 М.
Excel VBA Macro: Send Email with Picture in Body (Embedded Image)
8:57
Make your Pivot Tables in Excel update automatically without having to click refresh | L0026
1:14:06
The joker favorite#joker  #shorts
00:15
Untitled Joker
Рет қаралды 30 МЛН