Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Call Application.Volatile(True) NOT WORKING

Inserting a sheet does not trigger a calculation. Deleting a sheet *does*
trigger a calculation.

If the sheets are inserted with code, after you insert them add a line of
code to calculate.

--
Biff
Microsoft Excel MVP


"FARAZ QURESHI" wrote in message
...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application.Volatile Not Working Timely FARAZ QURESHI Excel Discussion (Misc queries) 2 March 10th 08 09:52 AM
Search for 2 true arguments and return true or false David Excel Discussion (Misc queries) 3 July 15th 06 10:18 AM
Call Center Management: How to calculate 'cost per call' Denniso6 Excel Discussion (Misc queries) 2 June 25th 06 05:01 PM
Function to return True/False if all are validated as True by ISNU Tetsuya Oguma Excel Worksheet Functions 2 March 15th 06 10:28 AM
Application.Volatile not working as expected Richards Excel Discussion (Misc queries) 3 February 3rd 05 12:20 AM


All times are GMT +1. The time now is 09:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"