PDA

View Full Version : Running Macro when a Dropdown Box Changes



Emmerly
01-21-2015, 04:13 AM
Hi,

I'm a bit stuck on something so would appreciate some help, I'm making a task list and I'd like it to send an email when a task has been completed, to mark a task as being complete I've created a dropdown box.

I've got a macro for the dropdown box change but for some reason it can't find the macro. I'm sure it's something really stupid that is going wrong, I'm still using Excel 2003.

This is the code as it stands:


Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("E1:E10")) Is Nothing Then
Application.Run "abc"
End If

End Sub


Sub abc()

ActiveSheet.Range("A1:E10").Select

ActiveWorkbook.EnvelopeVisible = True

.Item.To = "EmailAddress"
.Item.Subject = "Emma - Task Update"
.Item.Send
End With

End Sub

Bob Phillips
01-21-2015, 04:20 AM
Is the Worksheet_Change code in the worksheet module?

Emmerly
01-21-2015, 04:24 AM
Hi, it is.


Thanks

Bob Phillips
01-21-2015, 05:37 AM
That's odd, it works in my Excel. Maybe events are off, so try typing

Application.EnableEvents = True

in the immediate window.

Emmerly
01-21-2015, 06:07 AM
Thanks, that seems to have done the trick!