Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i enable "Group" & "Ungroup" in a protected sheet DBLA137 Excel Discussion (Misc queries) 1 March 11th 09 12:20 AM
how do i enable a drop down list depending on result of "if" funct Varun Excel Worksheet Functions 3 August 8th 06 04:44 PM
How to disable annoying "Enable Macro" popup Eric Excel Programming 2 November 28th 05 04:59 PM
How to realize "enable macro" by VBA when opening a file with macr FrankJIN Excel Programming 1 August 16th 05 04:32 AM
excel.application.run macro1 -- added code to respond "yes" to a inputbox Michael Joe Excel Programming 3 August 13th 04 10:11 PM


All times are GMT +1. The time now is 07:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"