Forum

Detect color change
 
Notifications
Clear all

Detect color change

4 Posts
3 Users
0 Reactions
286 Views
(@retiredit)
Posts: 22
Eminent Member
Topic starter
 

I am very new to VBA so I'm struggling with something I'm trying to do.

In my spreadsheet I was to detect when the color of a cell has changed. The change is always made by a user and not a formula. I'm using Office 356.

My end goal is to create a running total of expenses excluding those that are pending but not paid. All pending and not paid have a yellow background. Once the expense is paid the yellow background is removed manually.

 

In advance, thank you for your help

 
Posted : 27/06/2023 10:59 am
(@debaser)
Posts: 836
Member Moderator
 

Changing the colour of a cell does not trigger any events that you can respond to. If you can, you would be far better off using an additional column/cell to hold the status. You can then sum based on that column using normal formulas, and you can also colour the cell(s) based on the selected status using conditional formatting.

 
Posted : 27/06/2023 11:56 am
(@keebellah)
Posts: 373
Reputable Member
 

I also suggest you tell us which version of Excel AND OS you're using, 

 
Posted : 28/06/2023 2:38 am
(@retiredit)
Posts: 22
Eminent Member
Topic starter
 

Since I posted this question, I actually found a solution that almost satisfies the question. This function works:

=GET.CELL(63,INDIRECT("rc, FALSE)) in that it will put a number in a cell based on the background color of the cell. One of the problems with this function is that it doesn't auto recalculate when the color changes, the whole worksheet needs to recalculate. It also needs to be placed in the Name Manager and called indirectly.

Sorry about the transposition in the original posting, I'm using Office 365 not Office 356.

This question can now be considered closed.

 
Posted : 28/06/2023 6:43 am
Share: