View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default Using Input Box results in a formula

Sub dividedays()
Range("b1").Value = InputBox("How many days in event") / InputBox("How far
through")
End Sub

Don Guillett
SalesAid Software

"PaulSinki" wrote in message
...
Hi, I was hoping someone could help me.
I've got a macro that asks the user for two inputs, defined as MyValue1
and MyValue2. How do I use the results in a formula though?
This is the code that I have currently:

MyValue1 = Application.InputBox("How many days is the current event?")
MyValue2 = Application.InputBox("How far through the current event
are you?")
Range("Y1").Select
ActiveCell.FormulaR1C1 = "=[MyValue1]/[MyValue2]"

However, it crashes out on putting the formula in. How do I correctly
call the results of MyValue1 & 2 and put them into a formula?

Any help greatly appreciated!
Thanks,
Paul


---
Message posted from
http://www.ExcelForum.com/