entering arbitrary numbers in formula to get a different answer

P

pcscsr

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
 
B

Bob Phillips

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top