Running a macro from a conditional formula
I'd like to run one of two different macros I have created based on a Yes or
No answer in a cell. I've tryed the following formula: =IF(K16="No", Macro "Closed", Macro "Not_Closed) I was just guessing at the command to run a macro from a cell, but was not correct. Any help? Thanks JIM |
Running a macro from a conditional formula
hi,
not even close. formulas return values, they cannot perform actions like call a macro. (also copy, paste, move, change color, phone home, ect) but you can write a macro to do this. put it in the worksheet change event. it might look something like this. Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) If Range("B5").Value = "Y" Then Call Macro1 Else If Range("B5").Value = "N" Then call macro2 End If End If End Sub hope this gives you ideas. good luck regards FSt1 "Jim" wrote: I'd like to run one of two different macros I have created based on a Yes or No answer in a cell. I've tryed the following formula: =IF(K16="No", Macro "Closed", Macro "Not_Closed) I was just guessing at the command to run a macro from a cell, but was not correct. Any help? Thanks JIM |
All times are GMT +1. The time now is 02:21 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com