hartless43
New Member
- Joined
- Dec 28, 2022
- Messages
- 35
- Office Version
- 365
- Platform
- Windows
Here is a Function given to me by FLUFF (on another forum) and would like to be able to disable it based on a cell value because I am using an Algorithm that creates a Sudoku Solution in about 10-15 seconds but with a function that is calculating faster than a speeding bullet it takes a very, very, forever for the Algorithm to create a solution. I am currently using a YES or NO to not show the mistakes.
I would like to have a statement like this: If Range("W14") = "NO" then End Function
Code:
Function CountByFontColor(Data As Range, CellRefColor As Range)
Dim CellColor As Long
Dim CurrentCell As Range
Dim CountFont As Long
Application.Volatile
CountFont = 0
CellColor = CellRefColor.Font.ColorIndex
For Each CurrentCell In Data
If CellColor = Evaluate("CFColour(" & CurrentCell.Address & ")") Then
CountCell = CountCell + 1
End If
Next CurrentCell
CountByFontColor = CountCell
End Function
Function CFColour(Cl As Range) As Double
CFColour = Cl.DisplayFormat.Font.ColorIndex
End Function
'writen by Fluff13 Excel Forum Guru
I would like to have a statement like this: If Range("W14") = "NO" then End Function