run when value changes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

how do i get a code to run when i change the value in a cell?

cell a1 is blank, i enter 1 "codeone" runs, i enter 2 "codetwo" runs

thanks in advance
 
The following code, placed in the Worksheet Module - (right-click the sheet
tab and select View Code) should start you off. If the the cell changed is
A1 (row 1, column 1) it calls subs depending on the value entered. 1 -
CodeOne etc.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 1 And Target.Column = 1 Then
Select Case Target.Value
Case 1
CodeOne
Case 2
CodeTwo
Case 3
CodeThree
End Select
End If
End Sub


regards,
Don
 
not working for some reason, im not sure if i understand the Cases that well
in EP3 i have a drop down list..values are (Utilities, Paychecks, Other)

if Utilities is selected application.run "code1"
if Paychecks is selected application.run "code2"
if Other is selected application.run "code3"

so do i put case "Utilities":
application.run "code1" ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top