+ Reply to Thread
Results 1 to 5 of 5

Worksheet Calculations Exclude Custom Formula

  1. #1
    Geoff
    Guest

    Worksheet Calculations Exclude Custom Formula

    I want to exclude certain custom calculations calculating when I use the VBA
    worksheet calculate event (i.e. Activesheet.Calculate) on custom functions.
    Is this possible?

    Thanks in advance




  2. #2
    Dave Peterson
    Guest

    Re: Worksheet Calculations Exclude Custom Formula

    This seemed to work in simple testing. Maybe you can enhance it:

    Option Explicit
    Public StopCalc As Boolean
    Function myFunc() As Variant
    Application.Volatile True
    If StopCalc Then
    myFunc = Application.Caller.Text
    Exit Function
    Else
    myFunc = Now
    End If
    End Function
    Sub testme01()
    StopCalc = True
    ActiveSheet.Calculate
    StopCalc = False
    End Sub
    Sub testme02()
    ActiveSheet.Calculate
    End Sub




    Geoff wrote:
    >
    > I want to exclude certain custom calculations calculating when I use the VBA
    > worksheet calculate event (i.e. Activesheet.Calculate) on custom functions.
    > Is this possible?
    >
    > Thanks in advance


    --

    Dave Peterson

  3. #3
    Geoff
    Guest

    Re: Worksheet Calculations Exclude Custom Formula

    Thanks - Had .value which did not work.

    "Dave Peterson" <[email protected]> wrote in message
    news:[email protected]...
    > This seemed to work in simple testing. Maybe you can enhance it:
    >
    > Option Explicit
    > Public StopCalc As Boolean
    > Function myFunc() As Variant
    > Application.Volatile True
    > If StopCalc Then
    > myFunc = Application.Caller.Text
    > Exit Function
    > Else
    > myFunc = Now
    > End If
    > End Function
    > Sub testme01()
    > StopCalc = True
    > ActiveSheet.Calculate
    > StopCalc = False
    > End Sub
    > Sub testme02()
    > ActiveSheet.Calculate
    > End Sub
    >
    >
    >
    >
    > Geoff wrote:
    >>
    >> I want to exclude certain custom calculations calculating when I use the
    >> VBA
    >> worksheet calculate event (i.e. Activesheet.Calculate) on custom
    >> functions.
    >> Is this possible?
    >>
    >> Thanks in advance

    >
    > --
    >
    > Dave Peterson




  4. #4
    Dave Peterson
    Guest

    Re: Worksheet Calculations Exclude Custom Formula

    You may have gotten a faster response if you had shared your code and indicated
    what didn't work.

    Geoff wrote:
    >
    > Thanks - Had .value which did not work.
    >
    > "Dave Peterson" <[email protected]> wrote in message
    > news:[email protected]...
    > > This seemed to work in simple testing. Maybe you can enhance it:
    > >
    > > Option Explicit
    > > Public StopCalc As Boolean
    > > Function myFunc() As Variant
    > > Application.Volatile True
    > > If StopCalc Then
    > > myFunc = Application.Caller.Text
    > > Exit Function
    > > Else
    > > myFunc = Now
    > > End If
    > > End Function
    > > Sub testme01()
    > > StopCalc = True
    > > ActiveSheet.Calculate
    > > StopCalc = False
    > > End Sub
    > > Sub testme02()
    > > ActiveSheet.Calculate
    > > End Sub
    > >
    > >
    > >
    > >
    > > Geoff wrote:
    > >>
    > >> I want to exclude certain custom calculations calculating when I use the
    > >> VBA
    > >> worksheet calculate event (i.e. Activesheet.Calculate) on custom
    > >> functions.
    > >> Is this possible?
    > >>
    > >> Thanks in advance

    > >
    > > --
    > >
    > > Dave Peterson


    --

    Dave Peterson

  5. #5
    Geoff
    Guest

    Re: Worksheet Calculations Exclude Custom Formula

    True. I was trying different methods with one even being an iteration
    process to find, but this was not optimal. Thanks again and will do next
    time.

    "Dave Peterson" <[email protected]> wrote in message
    news:[email protected]...
    > You may have gotten a faster response if you had shared your code and
    > indicated
    > what didn't work.
    >
    > Geoff wrote:
    >>
    >> Thanks - Had .value which did not work.
    >>
    >> "Dave Peterson" <[email protected]> wrote in message
    >> news:[email protected]...
    >> > This seemed to work in simple testing. Maybe you can enhance it:
    >> >
    >> > Option Explicit
    >> > Public StopCalc As Boolean
    >> > Function myFunc() As Variant
    >> > Application.Volatile True
    >> > If StopCalc Then
    >> > myFunc = Application.Caller.Text
    >> > Exit Function
    >> > Else
    >> > myFunc = Now
    >> > End If
    >> > End Function
    >> > Sub testme01()
    >> > StopCalc = True
    >> > ActiveSheet.Calculate
    >> > StopCalc = False
    >> > End Sub
    >> > Sub testme02()
    >> > ActiveSheet.Calculate
    >> > End Sub
    >> >
    >> >
    >> >
    >> >
    >> > Geoff wrote:
    >> >>
    >> >> I want to exclude certain custom calculations calculating when I use
    >> >> the
    >> >> VBA
    >> >> worksheet calculate event (i.e. Activesheet.Calculate) on custom
    >> >> functions.
    >> >> Is this possible?
    >> >>
    >> >> Thanks in advance
    >> >
    >> > --
    >> >
    >> > Dave Peterson

    >
    > --
    >
    > Dave Peterson




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1