View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
FARAZ QURESHI FARAZ QURESHI is offline
external usenet poster
 
Posts: 553
Default Call Application.Volatile(True) NOT WORKING

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?
--

Best Regards,
FARAZ A. QURESHI