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". |
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 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". |
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 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". |
All times are GMT +1. The time now is 11:37 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com