![]() |
Trigger a Macro from the result of a function? "If A1= Yes, Enable Macro1"
Alan,
I must have misread your post as l did not relaise you wanted the macro to fire automatically. Using your example the following code will fire if the user enters anything into the target cells expect the word 'nothing'. The code must be placed, as in your example, in the sheet 2 code module and the Worksheet_Change event. Please note that if the values in the target cells are changed by way by of a formula the event will not trigger. The target addresses must be cells that are changed manually. Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$B$4" Or _ Target.Address = "$F$4" Or _ Target.Address = "$I$4" Or _ Target.Address = "$B$6" Or _ Target.Address = "$F$6" Or _ Target.Address = "$I$6" Then If Target.Value < "Nothing" Then MsgBox ("You have entered something") CHANGE THIS TO CALL YOUR MACRO End If End If End Sub Regards Michael Beckinsale |
All times are GMT +1. The time now is 03:06 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com