• If Statement with a macro (2000)

    Author
    Topic
    #367492

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

    Thanks

    Viewing 1 reply thread
    Author
    Replies
    • #573123

      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

      • #573129

        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.

    • #573157

      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.

    Viewing 1 reply thread
    Reply To: If Statement with a macro (2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: