People do weird and wonderful things in Excel.
Other people then have to pull out the data from those spreadsheets.
“Other people” tend to spend a lot of time crying into their coffee.
At the moment, I am trying to pull out data of a spreadsheet, where “something” can have a value of 1, 2 or 3. That is of course marked by an “x” in a cell. I need to convert that x to a number.
That is rather simple. What is not so simple, is that there can be two x’es. One, in black, to denote the current state of affairs. And a second x, in red, to denote what a future, state is wanted to be.
So – I need a way to get the color of an x. VBA can do that:
Function GetColour(ByVal Target As Range) As Single
GetColour = Target.Font.Color
And if I need a logical test:
Function IsBlack(ByVal Target As Range) As Boolean
If Target.Font.Color = 0 Then
IsBlack = True
IsBlack = False