Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 27
Default Turn on/off calculation in worksheet

Can anyone please advise me how I would write a worksheet selection
event code so that when you select a particular worksheet it turns the
calculation on and then turns it off when you select another worksheet
in the same workbook.

I have one particular part of a worksheet that extracts a whole load
of information from the main sheet using a series of sumproduct
formulas but of course this is very slow in doing the calculations and
as this information is only required on the odd occasion it would be
beneficial and a whole lot quicker if I was able to turn off the
calculation on that particular worksheet until it was required.

Any help would be most appreciated. -

ps I have never used a worksheet event but have been advised that this
is the best course of action - I have no idea how or where to input
this coding/information

Thanks

Bjthebear
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 27
Default Turn on/off calculation in worksheet

On Apr 26, 12:26*pm, "BJ&theBear"
wrote:
Can anyone please advise me how I would write a worksheet selection
event code so that when you select a particular worksheet it turns the
calculation on and then turns it off when you select another worksheet
in the same workbook.

*I have one particular part of a worksheet that extracts a whole load
of information from the main sheet using a series of sumproduct
formulas but of course this is very slow in doing the calculations and
as this information is only required on the odd occasion it would be
beneficial and a whole lot quicker if I was able to turn off the
calculation on that particular worksheet until it was required.

Any help would be most appreciated. -

ps I have never used a worksheet event but have been advised that this
is the best course of action - I have no idea how or where to input
this coding/information

Thanks

Bjthebear


Sorry using Excel 2003 - forgot to mention

BJthebear
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Turn on/off calculation in worksheet

Hi,

To instal this use ALT+F11 to open VB editor. Doubleclick 'ThisWorkbook' and
paste the code in on the right. Change the name of the sheet to suit and
whwnever that sheet is activated calculation changes to manual and activates
to auto for all other sheets

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If ActiveSheet.Name = ("Sheet1") Then
Application.Calculation = xlManual
Else
Application.Calculation = xlAutomatic
End If
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"BJ&theBear" wrote:

Can anyone please advise me how I would write a worksheet selection
event code so that when you select a particular worksheet it turns the
calculation on and then turns it off when you select another worksheet
in the same workbook.

I have one particular part of a worksheet that extracts a whole load
of information from the main sheet using a series of sumproduct
formulas but of course this is very slow in doing the calculations and
as this information is only required on the odd occasion it would be
beneficial and a whole lot quicker if I was able to turn off the
calculation on that particular worksheet until it was required.

Any help would be most appreciated. -

ps I have never used a worksheet event but have been advised that this
is the best course of action - I have no idea how or where to input
this coding/information

Thanks

Bjthebear
.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 27
Default Turn on/off calculation in worksheet

On Apr 26, 1:10*pm, Mike H wrote:
Hi,

To instal this use ALT+F11 to open VB editor. Doubleclick 'ThisWorkbook' and
paste the code in on the right. Change the name of the sheet to suit and
whwnever that sheet is activated calculation changes to manual and activates
to auto for all other sheets

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If ActiveSheet.Name = ("Sheet1") Then
* * Application.Calculation = xlManual
Else
* * Application.Calculation = xlAutomatic
End If
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.



"BJ&theBear" wrote:
Can anyone please advise me how I would write a worksheet selection
event code so that when you select a particular worksheet it turns the
calculation on and then turns it off when you select another worksheet
in the same workbook.


*I have one particular part of a worksheet that extracts a whole load
of information from the main sheet using a series of sumproduct
formulas but of course this is very slow in doing the calculations and
as this information is only required on the odd occasion it would be
beneficial and a whole lot quicker if I was able to turn off the
calculation on that particular worksheet until it was required.


Any help would be most appreciated. -


ps I have never used a worksheet event but have been advised that this
is the best course of action - I have no idea how or where to input
this coding/information


Thanks


Bjthebear
.- Hide quoted text -


- Show quoted text -


Thanks Mike

Much appreciated

BJ
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 968
Default Turn on/off calculation in worksheet

Sadly that won't work: Calculation mode is set for all the worksheets
in all the open workbooks, so when you select another sheet
calculation mode will be set to automatic and ALL the sheets will ne
calculated.

You would have to do something like this:

Set Calculation to Manual.

in the Thisworkbook module add this

Private Sub Workbook_Open()
Application.Calculation = xlCalculationManual
Worksheets("SumproductSheet").EnableCalculation = False
End Sub

and in the SumProductSheet module add this

Private Sub Worksheet_Activate()
ActiveSheet.EnableCalculation = True
Calculate
ActiveSheet.EnableCalculation = False
End Sub

regards
Charles


Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If ActiveSheet.Name = ("Sheet1") Then
Application.Calculation = xlManual
Else
Application.Calculation = xlAutomatic
End If
End Sub



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
Worksheet tabs to turn colors against criteria Neall Excel Worksheet Functions 3 June 5th 09 04:26 PM
Turn off or not include lines in a calculation DLAYMANS Excel Worksheet Functions 3 September 12th 08 04:02 AM
how do i turn off calculation of cells blabla Excel Discussion (Misc queries) 1 May 26th 08 04:48 PM
A change in Excel worksheet and all my link turn into #value! Fabrice Excel Discussion (Misc queries) 0 October 6th 06 05:12 PM
Turn off hyperlinks in a selected worksheet Jaybird Excel Discussion (Misc queries) 1 April 9th 05 03:04 PM


All times are GMT +1. The time now is 08:34 AM.

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"