Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 266
Default Detecting Calc On or Off

I have 2 radio buttons - one marked "Calc On" and one marked "Calc Off".
The user can turn auto calc on or off. There are other macros in the
spreadsheet - and I also turn calc off during those macros and then turn it
back on. What I want is to be able to detect what the current setting is and
then set it to that at the end of macro execution. So if Calc is "OFF" then
at the end of the macro I want to leave it off. Any advice is appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 896
Default Detecting Calc On or Off

one way might be to use this function:

Function calc()

If Application.Calculation = xlCalculationManual Then
calc = "Manual"
ElseIf Application.Calculation = xlCalculationAutomatic Then
calc = "Automatic"
Else
calc = "SemiAutomatic"
End If

End Function


and then use 1 of existing buttons to change the setting

to insert this function press ALT+F11 to go Visual Basic window, then
Insert-Module and paste this code

otherwise you would have to change all existing macros to reflect the
current calculation setting


On 21 Kwi, 10:48, dhstein wrote:
I have 2 radio buttons - one marked "Calc On" *and one marked "Calc Off". *
The user can turn auto calc on or off. *There are other macros in the
spreadsheet - and I also turn calc off during those macros and then turn it
back on. *What I want is to be able to detect what the current setting is and
then set it to that at the end of macro execution. *So if Calc is "OFF" then
at the end of the macro I want to leave it off. *Any advice is appreciated.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 896
Default Detecting Calc On or Off

forgot to add:

insert =calc() into any unused cell to determine the current setting

then use yr "Calc On"/"Calc Off" button


On 21 Kwi, 11:21, Jarek Kujawa wrote:
one way might be to use this function:

Function calc()

If Application.Calculation = xlCalculationManual Then
* * calc = "Manual"
ElseIf Application.Calculation = xlCalculationAutomatic Then
* * calc = "Automatic"
Else
* * calc = "SemiAutomatic"
End If

End Function

and then use 1 of existing buttons to change the setting

to insert this function press ALT+F11 to go Visual Basic window, then
Insert-Module and paste this code

otherwise you would have to change all existing macros to reflect the
current calculation setting

On 21 Kwi, 10:48, dhstein wrote:



I have 2 radio buttons - one marked "Calc On" *and one marked "Calc Off". *
The user can turn auto calc on or off. *There are other macros in the
spreadsheet - and I also turn calc off during those macros and then turn it
back on. *What I want is to be able to detect what the current setting is and
then set it to that at the end of macro execution. *So if Calc is "OFF" then
at the end of the macro I want to leave it off. *Any advice is appreciated.- Ukryj cytowany tekst -


- Poka¿ cytowany tekst -


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 266
Default Detecting Calc On or Off

Jarek,

Thanks for the reply, but the test doesn't seem to work. I checked and did
a MsgBox on Application.Calculation and the result always comes back as -4135
no matter what state the calc is in.

David


"Jarek Kujawa" wrote:

one way might be to use this function:

Function calc()

If Application.Calculation = xlCalculationManual Then
calc = "Manual"
ElseIf Application.Calculation = xlCalculationAutomatic Then
calc = "Automatic"
Else
calc = "SemiAutomatic"
End If

End Function


and then use 1 of existing buttons to change the setting

to insert this function press ALT+F11 to go Visual Basic window, then
Insert-Module and paste this code

otherwise you would have to change all existing macros to reflect the
current calculation setting


On 21 Kwi, 10:48, dhstein wrote:
I have 2 radio buttons - one marked "Calc On" and one marked "Calc Off".
The user can turn auto calc on or off. There are other macros in the
spreadsheet - and I also turn calc off during those macros and then turn it
back on. What I want is to be able to detect what the current setting is and
then set it to that at the end of macro execution. So if Calc is "OFF" then
at the end of the macro I want to leave it off. Any advice is appreciated.



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 896
Default Detecting Calc On or Off

what I meant was:

1. use Sub Licz() (below) to determine the current setting
2. use any of your macros
3. change the setting with your "Calc On"/"Calc Off" buttons


Sub licz()

If Application.Calculation = xlCalculationManual Then
calc = "Manual"
ElseIf Application.Calculation = xlCalculationAutomatic Then
calc = "Automatic"
Else
calc = "SemiAutomatic"
End If

MsgBox calc
End Sub


works on my Excel 2007


On 21 Kwi, 14:09, dhstein wrote:
Jarek,

Thanks for the reply, but the test doesn't seem to work. Â*I checked and did
a MsgBox on Application.Calculation and the result always comes back as -4135
no matter what state the calc is in.

David



"Jarek Kujawa" wrote:
one way might be to use this function:


Function calc()


If Application.Calculation = xlCalculationManual Then
Â* Â* calc = "Manual"
ElseIf Application.Calculation = xlCalculationAutomatic Then
Â* Â* calc = "Automatic"
Else
Â* Â* calc = "SemiAutomatic"
End If


End Function


and then use 1 of existing buttons to change the setting


to insert this function press ALT+F11 to go Visual Basic window, then
Insert-Module and paste this code


otherwise you would have to change all existing macros to reflect the
current calculation setting


On 21 Kwi, 10:48, dhstein wrote:
I have 2 radio buttons - one marked "Calc On" Â*and one marked "Calc Off". Â*
The user can turn auto calc on or off. Â*There are other macros in the
spreadsheet - and I also turn calc off during those macros and then turn it
back on. Â*What I want is to be able to detect what the current setting is and
then set it to that at the end of macro execution. Â*So if Calc is "OFF" then
at the end of the macro I want to leave it off. Â*Any advice is appreciated.- Ukryj cytowany tekst -


- Pokaż cytowany tekst -




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 266
Default Detecting Calc On or Off


Thanks Jarek - it's working now - I'm not sure what I did wrong the first
time.

"Jarek Kujawa" wrote:

what I meant was:

1. use Sub Licz() (below) to determine the current setting
2. use any of your macros
3. change the setting with your "Calc On"/"Calc Off" buttons


Sub licz()

If Application.Calculation = xlCalculationManual Then
calc = "Manual"
ElseIf Application.Calculation = xlCalculationAutomatic Then
calc = "Automatic"
Else
calc = "SemiAutomatic"
End If

MsgBox calc
End Sub


works on my Excel 2007


On 21 Kwi, 14:09, dhstein wrote:
Jarek,

Thanks for the reply, but the test doesn't seem to work. I checked and did
a MsgBox on Application.Calculation and the result always comes back as -4135
no matter what state the calc is in.

David



"Jarek Kujawa" wrote:
one way might be to use this function:


Function calc()


If Application.Calculation = xlCalculationManual Then
calc = "Manual"
ElseIf Application.Calculation = xlCalculationAutomatic Then
calc = "Automatic"
Else
calc = "SemiAutomatic"
End If


End Function


and then use 1 of existing buttons to change the setting


to insert this function press ALT+F11 to go Visual Basic window, then
Insert-Module and paste this code


otherwise you would have to change all existing macros to reflect the
current calculation setting


On 21 Kwi, 10:48, dhstein wrote:
I have 2 radio buttons - one marked "Calc On" and one marked "Calc Off".
The user can turn auto calc on or off. There are other macros in the
spreadsheet - and I also turn calc off during those macros and then turn it
back on. What I want is to be able to detect what the current setting is and
then set it to that at the end of macro execution. So if Calc is "OFF" then
at the end of the macro I want to leave it off. Any advice is appreciated.- Ukryj cytowany tekst -


- Pokaż cytowany tekst -



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
Calc = Manual & Do Not Calc b/4 SAVE Ken Excel Discussion (Misc queries) 0 October 3rd 07 02:28 PM
My calc key on Excel changes box to "Text" Box and doesn't calc ? jack Charts and Charting in Excel 0 August 8th 06 07:30 PM
auto calc on, but have to edit (f2) cells to force re-calc..help! Curt Excel Worksheet Functions 3 February 13th 06 06:05 PM
Detecting absentees gracegift Excel Discussion (Misc queries) 7 December 27th 04 11:35 PM
Detecting a color Duncan Help Excel Worksheet Functions 5 December 9th 04 08:12 PM


All times are GMT +1. The time now is 12:45 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"