Consulting

Results 1 to 6 of 6

Thread: stop formulae from updating

  1. #1

    stop formulae from updating

    I have a sheet that has dynamic formulae which keep updating certain cells. I want to have a button that "freezes" the current screen and "locks in" all the values (no there is no further updating).

    a simple eg. : Cell J14 is 10, K14 is 5, L14 = J14 / K14 (which is 2). Now I want to "freeze" cell K14 so that if i change J14 or K14, L14 is still 2. Then, it would be nice if there was an "unfreeze" type function. Thanks !

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    [VBA]Sub toggleCalculation()
    If Application.Calculation = xlManual Then
    Application.Calculation = xlAutomatic
    Else
    Application.Calculation = xlManual
    End If
    End Sub[/VBA]

  3. #3
    thanks!

    any idea about the code to change the label of the button?

  4. #4
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    If the button is from the Forms Menu, this works for me.
    Sub toggleCalculation()
        If Application.Calculation = xlManual Then
            Application.Calculation = xlAutomatic
            ActiveSheet.Shapes(Application.Caller).OLEFormat.Object.Caption = "make manual"
            
        Else
            Application.Calculation = xlManual
            ActiveSheet.Shapes(Application.Caller).OLEFormat.Object.Caption = "make automatic"
        End If
    End Sub

  5. #5
    hmmm, but i get a "type mismatch" error for the lines:

    ActiveSheet.Shapes(Application.Caller).OLEFormat.Object.Caption = "make manual"

    and

    ActiveSheet.Shapes(Application.Caller).OLEFormat.Object.Caption = "make automatic"

    My button is just from the "Control Toolbox" part of the VBA toolbar in Excel. Thoughts??

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Private Sub CommandButton1_Click()
    If Application.Calculation = xlManual Then
    Application.Calculation = xlAutomatic
    Me.OLEObjects("CommandButton1").Object.Caption = "make manual"

    Else
    Application.Calculation = xlManual
    Me.OLEObjects("CommandButton1").Object.Caption = "make automatic"
    End If
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •