F
FARAZ QURESHI
I have a custom macro as below to count sheets in the current book:
Public Function CNTSH(Optional ByVal bIncludeChartSheets As Boolean = True)
As Integer
Call Application.Volatile(True)
If bIncludeChartSheets = True Then
CNTSH = Application.ActiveWorkbook.Sheets.Count
Else
CNTSH = Application.ActiveWorkbook.Worksheets.Count
End If
End Function
Upon adding a new sheet the result doesn't change unless I press:
F9; or
F2 & Enter;
Reenter the complete format.
Why? Application.Volatile has been set to true?
Public Function CNTSH(Optional ByVal bIncludeChartSheets As Boolean = True)
As Integer
Call Application.Volatile(True)
If bIncludeChartSheets = True Then
CNTSH = Application.ActiveWorkbook.Sheets.Count
Else
CNTSH = Application.ActiveWorkbook.Worksheets.Count
End If
End Function
Upon adding a new sheet the result doesn't change unless I press:
F9; or
F2 & Enter;
Reenter the complete format.
Why? Application.Volatile has been set to true?