ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   control formula with a macro? (https://www.excelbanter.com/excel-programming/339627-control-formula-macro.html)

jadeyes2612

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! :(


--
jadeyes2612
------------------------------------------------------------------------
jadeyes2612's Profile: http://www.excelforum.com/member.php...o&userid=25119
View this thread: http://www.excelforum.com/showthread...hreadid=466281


K Dales[_2_]

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(A120,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



jadeyes2612[_2_]

control 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 th
formula whenever I want to calculate the tax. I cannot specify th
condition because it's arbitrary, It depends on variuos variables tha
maybe present at the same time but maybe not. That is why I woul
prefer to control when the formula is applied.

thank

--
jadeyes261
-----------------------------------------------------------------------
jadeyes2612's Profile: http://www.excelforum.com/member.php...fo&userid=2511
View this thread: http://www.excelforum.com/showthread.php?threadid=46628



All times are GMT +1. The time now is 01:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com