+ Reply to Thread
Results 1 to 3 of 3

Can you enter a formula in a cell to run a macro?

  1. #1
    Nevaeh
    Guest

    Can you enter a formula in a cell to run a macro?

    Is there a way where I can enter a formula to run a macro? For example could
    I enter a formula that say "if this value is greater than or equal to run
    this macro".

  2. #2
    Gord Dibben
    Guest

    Re: Can you enter a formula in a cell to run a macro?

    A formula cannot run a macro.

    Event code behind the worksheet could be used to run a macro when a cell
    reaches a specific value.

    Private Sub Worksheet_Calculate()
    On Error GoTo enditall
    Application.EnableEvents = False
    If Range("$B$3").Value >= 123 Then
    ListColorIndexes
    End If
    enditall:
    Application.EnableEvents = True
    End Sub

    Right-click on a sheet tab and "View Code"

    Copy/paste the above in there.


    Gord Dibben Excel MVP


    On Mon, 14 Feb 2005 14:51:05 -0800, Nevaeh <[email protected]>
    wrote:

    >Is there a way where I can enter a formula to run a macro? For example could
    >I enter a formula that say "if this value is greater than or equal to run
    >this macro".



  3. #3
    Gord Dibben
    Guest

    Re: Can you enter a formula in a cell to run a macro?

    Jeez.........having a bad day.

    "ListColorIndexes" will of course be adjusted to your macroname.


    Gord

    On Mon, 14 Feb 2005 15:26:29 -0800, Gord Dibben <gorddibbATshawDOTca> wrote:

    >A formula cannot run a macro.
    >
    >Event code behind the worksheet could be used to run a macro when a cell
    >reaches a specific value.
    >
    >Private Sub Worksheet_Calculate()
    >On Error GoTo enditall
    > Application.EnableEvents = False
    > If Range("$B$3").Value >= 123 Then
    > ListColorIndexes
    > End If
    >enditall:
    > Application.EnableEvents = True
    >End Sub
    >
    >Right-click on a sheet tab and "View Code"
    >
    >Copy/paste the above in there.
    >
    >
    >Gord Dibben Excel MVP
    >
    >
    >On Mon, 14 Feb 2005 14:51:05 -0800, Nevaeh <[email protected]>
    >wrote:
    >
    >>Is there a way where I can enter a formula to run a macro? For example could
    >>I enter a formula that say "if this value is greater than or equal to run
    >>this macro".



+ 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