![]() |
entering arbitrary numbers in formula to get a different answer
I have the following code to add a percentage in a formula. Cells(n, 5) = "'+6%" Cells(n, 6).FormulaR1C1 = "=.6*r[-1]c" I sometimes use different percentages such as 7 or 10 etc...so what would like to know how to do is change the 6% somehow so that I can pu in a different number when I need to so the new number will show up o the worksheet. I hope this makes sense to someone. Thank you -- pcscs ----------------------------------------------------------------------- pcscsr's Profile: http://www.excelforum.com/member.php...fo&userid=1200 View this thread: http://www.excelforum.com/showthread.php?threadid=31904 |
entering arbitrary numbers in formula to get a different answer
Is this helpful?
ans = InputBox("Please supply percentage (as n%)") If ans < "" Then With Cells(n, 5) .Value = ans .NumberFormat = "0%" End With Cells(n, 6).FormulaR1C1 = "=.6*rC[-1]" End If -- HTH RP (remove nothere from the email address if mailing direct) "pcscsr" wrote in message ... I have the following code to add a percentage in a formula. Cells(n, 5) = "'+6%" Cells(n, 6).FormulaR1C1 = "=.6*r[-1]c" I sometimes use different percentages such as 7 or 10 etc...so what I would like to know how to do is change the 6% somehow so that I can put in a different number when I need to so the new number will show up on the worksheet. I hope this makes sense to someone. Thank you. -- pcscsr ------------------------------------------------------------------------ pcscsr's Profile: http://www.excelforum.com/member.php...o&userid=12006 View this thread: http://www.excelforum.com/showthread...hreadid=319048 |
entering arbitrary numbers in formula to get a different answer
absoultely..Thank you so much..you have made my day... :) -- pcscsr ------------------------------------------------------------------------ pcscsr's Profile: http://www.excelforum.com/member.php...o&userid=12006 View this thread: http://www.excelforum.com/showthread...hreadid=319048 |
entering arbitrary numbers in formula to get a different answer
pcscsr wrote in message ...
I have the following code to add a percentage in a formula. Cells(n, 5) = "'+6%" Cells(n, 6).FormulaR1C1 = "=.6*r[-1]c" I sometimes use different percentages such as 7 or 10 etc...so what I would like to know how to do is change the 6% somehow so that I can put in a different number when I need to so the new number will show up on the worksheet. I hope this makes sense to someone. Thank you. Does this help? Sub asdf() Dim n&, s$ n = 10 Cells(n, 5).Formula = "+6%" s = Cells(n, 5).Address(, , xlR1C1) Cells(n, 6).FormulaR1C1 = "=" & s & "*r[-1]c" End End Sub Dave |
All times are GMT +1. The time now is 07:57 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com