Background formatting from two values drawn from formulas
Closed
Nickthompson94
Posts
1
Registration date
Thursday November 1, 2018
Status
Member
Last seen
November 1, 2018
-
Nov 1, 2018 at 09:32 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Nov 1, 2018 at 12:51 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Nov 1, 2018 at 12:51 PM
Related:
- Background formatting from two values drawn from formulas
- Viber background - Guide
- Wechat background - Guide
- Notepad++ background color - Guide
- Clear only the formatting from the selected cell (leaving the content) - Guide
- Spreadsheet formulas - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Nov 1, 2018 at 12:51 PM
Nov 1, 2018 at 12:51 PM
Hi Nick,
Formula's can't colour cells, so we have to use VBA.
The way the code below works is that whenever you make a change to your table of values, the formula in column O will recalculate. This will trigger the code. The only thing you have to keep in mind is to use the enter or arrow down keys to confirm your entry for the code to work as it is designed. The value in column N is then looked up in row 4 of columns A to L. Finally the colours are matched.
Here is the code:
To implement the code, right-click your sheets tab and select view code, then paste the code above in the big white field.
Is this a good solution for you?
Best regards,
Trowa
Formula's can't colour cells, so we have to use VBA.
The way the code below works is that whenever you make a change to your table of values, the formula in column O will recalculate. This will trigger the code. The only thing you have to keep in mind is to use the enter or arrow down keys to confirm your entry for the code to work as it is designed. The value in column N is then looked up in row 4 of columns A to L. Finally the colours are matched.
Here is the code:
Private Sub Worksheet_Calculate() Dim fCell, dCell As Range Set dCell = Range("N" & ActiveCell.Row).Offset(-1, 0) Set fCell = Range("A4:L4").Find(dCell.Value) fCell.Copy dCell.PasteSpecial xlPasteFormats Application.CutCopyMode = False End Sub
To implement the code, right-click your sheets tab and select view code, then paste the code above in the big white field.
Is this a good solution for you?
Best regards,
Trowa