Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default run when value changes

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default run when value changes

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
"choice" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default run when value changes

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" ?

"Don Lloyd" wrote:

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
"choice" wrote in message
...
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




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



All times are GMT +1. The time now is 05:46 PM.

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"