Launching a Macro based on cell entry

Yadlik

New Member
Joined
May 8, 2002
Messages
40
Does anyone know if you can launch a macro based on a cell entry? For instance if a cell is equal to 3 or 9 I want the sheet sent.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try something like :

Public OldAdd As String

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
OldAdd = Target.Address
End Sub

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Range(OldAdd) = Range("A1") And Range(OldAdd).Value = 3 Or Range(OldAdd).Value = 9 Then
Application.Dialogs(xlDialogSendMail).Show
End If
End Sub

You will need to put it in the sheet module ( let me know if you're not sure ).

HTH

Iain
 
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,113,998
Members
448,541
Latest member
iparraguirre89

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top