Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Mar 2001
    Location
    USA
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts

    If Statement with a macro (2000)

    How do I write an if statement with Excel that says the following:
    If this happens, then run macro.

    Thanks

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: If Statement with a macro (2000)

    Well it depends on what "This" is.

    You cannot have a formula run a macro, but you can trap events and have code run if certain conditions are met, say the user selects a different worksheet, or a certain value is entered in a cell. Could you be a little more specific please.

    Andrew C

  3. #3
    Star Lounger
    Join Date
    Mar 2001
    Location
    USA
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: If Statement with a macro (2000)

    Thanks Andrew. At this point, I can not give any more detail. I will work on it more from my end and will post when I have more information.

    Thanks again.

  4. #4
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: If Statement with a macro (2000)

    The short answer is that you can't run a Sub procedure from a if statement in a worksheet. If it is a User Defined Function, then you can just specify the function as part of the formula in the IF statement true or false condition. If it can't be a User Defined Function because it is doing things that are not permitted in a UDF, then the only other possibility is to use one of the worksheet event routines to trigger the macro and have the macro do the IF.
    Legare Coleman

Posting Permissions

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