I have a problem with bad performance after implementing this code into my Excel list to count the filled cells without a color in the set range:
Function CountCcolor(range_data As Range, criteria As Range) As Long
Dim datax As Range
Dim xcolor As Long
xcolor = criteria.Interior.ColorIndex
For Each datax In range_data
If datax.Interior.ColorIndex = xcolor And Not datax.Value = vbNullString Then
CountCcolor = CountCcolor + 1
End If
Next datax
End Function
I use this one as well to count yellow and red cells on the same page in the set range, but it doesn't lower the performance as much as the one above:
Function Farbsumme(Bereich As Range, Farbe As Integer)
Dim Zelle As Range
Application.Volatile
For Each Zelle In Bereich
If Zelle.Interior.ColorIndex = Farbe Then
Farbsumme = Farbsumme + 1
End If
Next
End Function
Is there something I did wrong? Anything I could do better to increase the performance?
The most common reason for reduced FPS is graphics settings that create a larger workload than your hardware can handle. So how do you achieve better FPS? Getting a faster CPU, more RAM, or a newer graphics card is one solution.
What is a low FPS and what causes it? Low FPS, or frames per second, is when your game slows down because your computer doesn't have enough power or memory to run it properly. Common causes of low FPS are a weak graphics card, old graphics drivers, an outdated CPU, or insufficient RAM.
Low frames-per-second (FPS) rates, or frame rates in games are usually caused by computer hardware not being able to meet a game's system requirements at a given setting. If a device's hardware and a game's requirements are too far apart, a game will refuse to load.
Your CPU will always affect your in-game FPS because, as explained above, it's heavily involved in so many aspects of game processing. However, certain factors change how relevant the CPU is to your FPS. For one, while most games are very GPU intensive, some are CPU intensive.
You might be using the other function in your sheet and every time it recalculates the application.volatile
slows down your code.
Removing application.volatile
might solve your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With