+ Reply to Thread
Results 1 to 3 of 3

control formula with a macro?

Hybrid View

  1. #1
    Registered User
    Join Date
    07-11-2005
    Location
    puerto rico
    Posts
    2

    Unhappy control formula with a macro?

    I use an invoice form in which I have to charge a tax for some of the sales, I want to be able to control the formula so it only applies when I want. Can I do that with a macro? Please Help ME!

  2. #2
    K Dales
    Guest

    RE: control formula with a macro?

    Would need more info: what is your formula, and how do you decide when it
    applies? You can probably handle this through normal formulas (no need for a
    macro) by using the IF function;
    Worksheet version: =IF(condition,formula1,formula2)
    applies formula1 if the condition is true, otherwise formula2
    Example - I will have it apply a 7% tax if the amount in A1 is greater than
    $20, otherwise no tax applies:
    =IF(A1>20,A1*1.07,A1)

    If you need to put this in a macro, here is a VBA version:
    If Range("A1").Value > 20 Then
    Tax = Price * 0.07
    Else
    Tax = 0
    End If
    Price = Price + Tax
    --
    - K Dales


    "jadeyes2612" wrote:

    >
    > I use an invoice form in which I have to charge a tax for some of the
    > sales, I want to be able to control the formula so it only applies
    > when I want. Can I do that with a macro? Please Help ME!
    >
    >
    > --
    > jadeyes2612
    > ------------------------------------------------------------------------
    > jadeyes2612's Profile: http://www.excelforum.com/member.php...o&userid=25119
    > View this thread: http://www.excelforum.com/showthread...hreadid=466281
    >
    >


  3. #3
    Registered User
    Join Date
    07-11-2005
    Location
    puerto rico
    Posts
    2

    control a formula with a macro

    Hi:

    The formula is M36=M35*0.01
    What I would like to be able to do is assign a button to run the formula whenever I want to calculate the tax. I cannot specify the condition because it's arbitrary, It depends on variuos variables that maybe present at the same time but maybe not. That is why I would prefer to control when the formula is applied.

    thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1