ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA counting colors, errors (https://www.excelbanter.com/excel-programming/370764-re-vba-counting-colors-errors.html)

Ken Johnson

VBA counting colors, errors
 
TheRook wrote:
I am currently having 2 problems.
1. If an additional line in inserted with a specific color the count does
not automatically refresh. Can a loop be put in?


Hi Rook,
The closest I've ever got to autorefresh with this type of UDF is to...

1. add Application.Volatile at the start of the code, which forces the
function to be calculated whenever any other formulas are entered on
the sheet, and...

2. paste the following into the Sheet's code module...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Calculate
End Sub

which forces calculation of the sheet every time a selection change
occurs.

I don't know about your other problem, I couldn't reproduce it.

Ken Johnson



All times are GMT +1. The time now is 01:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com