Forum Discussion
Maintain formatting after refresh of data in Excel table via Power query
- 2 years ago
Unfortunately, I think you are correct in that you will have to continue your VBA solution. Perhaps using VBA to refresh the query and then, when that has been done, to restore your formatting.
And I did not fully understand your meaning when you wrote "formatting is linked to the column header." That is the case when dealing with tables generated by Power Query.
The font style, color, cell interior color, and the color and nature of the grid lines can be created with a Custom table style, and will be used when new columns are created. Unfortunately, it does not seem as if Conditional Formatting is a feature of the TableStyle object.
What exactly do you mean "formatting disappears"?
Is it the formatting of the column headers? or the formatting of the column contents?
Column headers are always text strings, and you can format that string in Power Query.
Column contents format may be trickier depending on the type of data in the columns.
Excel will format the column contents based on the content of each cell.
It's the grid colour and font colour of both the header and the contents. It also removes the conditional formatting from the contents
- ronrsnfld2 years ago
Super User
Thanks for clarifying.
I'll look into it later. (don't have time right now).
- DanielBaker2 years agoFrequent Visitor
Thanks - and it's not urgent because the VBA solution I have implemented is working
- ronrsnfld2 years ago
Super User
Unfortunately, I think you are correct in that you will have to continue your VBA solution. Perhaps using VBA to refresh the query and then, when that has been done, to restore your formatting.
And I did not fully understand your meaning when you wrote "formatting is linked to the column header." That is the case when dealing with tables generated by Power Query.
The font style, color, cell interior color, and the color and nature of the grid lines can be created with a Custom table style, and will be used when new columns are created. Unfortunately, it does not seem as if Conditional Formatting is a feature of the TableStyle object.