Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why the arbitrary spreadsheet size limitations? T Magritte Excel Discussion (Misc queries) 7 July 24th 08 09:12 AM
Entering numbers in a cel formula lagiant Excel Discussion (Misc queries) 2 May 8th 06 11:16 PM
Entering numbers in a cel formula argonaut Excel Worksheet Functions 2 May 8th 06 09:37 PM
how do you get # value returned by entering: =4^3 (answer 64)??? Sallie Excel Discussion (Misc queries) 10 May 4th 06 06:21 PM
Formula without using numbers after decimal in the answer Mustang Excel Discussion (Misc queries) 5 September 16th 05 04:35 PM


All times are GMT +1. The time now is 10:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"