how do u run a macro when a particular field is changed?
Manage your personal finances in Excel
Thanks Thanks:  0
Likes Likes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: how do u run a macro when a particular field is changed?

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Posts
    73
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    how do u run a macro when a particular field is changed?

    pls help!

  2. #2
    Legend NateO's Avatar
    Join Date
    Feb 2002
    Location
    Minneapolis, Mn, USA
    Posts
    9,700
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    If a cell range = field in this case then:

    Right click on your sheet, select view code and paste the following:

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("A1:b1000")) Is Nothing Then
    application.run("LMF's Macro Name")
    end if
    end sub

    Might want to change your target to something more pertinent to your worksheet.

    _________________
    Cheers, NateO

    [ This Message was edited by: NateO on 2002-03-19 10:05 ]

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Posts
    73
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    thank you for the code, but i actually want the macro to run when the value of the cell changes. like if i do If or vlookup.

    do u know what i am saying?



    [ This Message was edited by: LMF on 2002-03-19 10:31 ]

  4. #4
    Board Regular
    Join Date
    Mar 2002
    Posts
    73
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    can someone help me pls?

  5. #5
    Board Regular
    Join Date
    Mar 2002
    Posts
    73
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    pls help me NateO?

  6. #6
    Legend NateO's Avatar
    Join Date
    Feb 2002
    Location
    Minneapolis, Mn, USA
    Posts
    9,700
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Please works for me. Try:

    Right click on your sheet, select view code and paste the following:

    Private Sub Worksheet_Calculate()
    application.run("LMF's Macro Name")
    end sub


    _________________
    Cheers, NateO

    [ This Message was edited by: NateO on 2002-03-19 10:43 ]

  7. #7
    Board Regular
    Join Date
    Mar 2002
    Posts
    73
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    nothing happen!

  8. #8
    Legend NateO's Avatar
    Join Date
    Feb 2002
    Location
    Minneapolis, Mn, USA
    Posts
    9,700
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Do you have your calculation mode set to automatic?

    Tools->options->calculation set to automatic & click ok

  9. #9
    Board Regular
    Join Date
    Mar 2002
    Posts
    73
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    it is working now, but the thing i want it the macro to be run when a particular cell is change...

    pls help!


    [ This Message was edited by: LMF on 2002-03-19 10:51 ]

  10. #10
    Legend NateO's Avatar
    Join Date
    Feb 2002
    Location
    Minneapolis, Mn, USA
    Posts
    9,700
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    It's in the correct sheet code module?

    It works for me, not sure what the issue is....

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com