AW: manuelle oder automatische Berechnung
23.05.2005 14:36:07
Peter
Servus,
dann würde ich am besten das calculate ereignis vorschlagen, was natürlich doof ist wenn du auf manuel schaltest? Welchem Ereignis du das letztendlich zuweisen möchtest weis ich nicht, der folgende Code ist nur ein Vorschlag zur Güte, da du hierbei egal in welchem TB du bist, den Stand siehst, außer du schaltest auf manuel aber das hatten wir ja schon.
Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
Dim CB As CommandBar
Dim CBC As CommandBarButton
Dim CBP As CommandBarPopup
Dim i%
On Error Resume Next
Application.CommandBars("Meine Leiste").Delete
Set CB = Application.CommandBars.Add(Name:="Meine Leiste", _
temporary:=True, Position:=msoBarTop)
On Error GoTo 0
If Application.CommandBars("Meine Leiste").Visible = False Then
CB.Visible = True
If Application.Calculation = xlManual Then
Set CBP = CB.Controls.Add(Type:=msoControlPopup)
With CBP
.Caption = "Manuelle Berechnung auf Automatisch stellen?"
.OnAction = "berechnung"
End With
Else
Set CBP = CB.Controls.Add(Type:=msoControlPopup)
With CBP
.Caption = "Automatische Berechnung auf manuell stellen?"
.OnAction = "berechnung"
End With
End If
End If
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.CommandBars("Meine Leiste").Delete
End Sub
in ein Modul:
Sub berechnung()
If Application.Calculation = xlCalculationManual Then
Application.Calculation = xlCalculationAutomatic
Else
Application.Calculation = xlCalculationManual
End If
End Sub
MfG Peter