Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using Input Box results in a formula

Hi, I was hoping someone could help me.
I've got a macro that asks the user for two inputs, defined as MyValue
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 even
are you?")
Range("Y1").Select
ActiveCell.FormulaR1C1 = "=[MyValue1]/[MyValue2]"

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

Any help greatly appreciated!
Thanks,
Pau

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Using Input Box results in a formula

Try this:

Range("Y1").Select
ActiveCell.Value = MyValue1/MyValue2

-IA

-----Original 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/

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Using Input Box results in a formula

Paul

Why do you need a formula entered into Y1?

You can enter the computed value directly.

Public Sub qwerty()
Dim MyValue1 As Long
Dim MyValue2 As Long
MyValue1 = InputBox("How many days is the current event?")
MyValue2 = InputBox("How far through the current event are you?")
Range("Y1").Select
ActiveCell.Value = MyValue1 / MyValue2
End Sub

Gord Dibben Excel MVP

On Thu, 11 Dec 2003 11:07:59 -0600, PaulSinki
wrote:

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/


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
When I enter a formula, Excel shows the formula not the results Pat Adams Excel Worksheet Functions 5 April 4th 23 11:18 AM
Input formulas in a defined data range and convert results as valu Tan New Users to Excel 0 April 18th 07 12:54 AM
Multiple input and output results smoothie Excel Discussion (Misc queries) 0 June 12th 06 05:58 PM
Calculate multiple results from multiple input values? Jetta1515 Excel Discussion (Misc queries) 5 June 1st 06 03:09 PM
how do i input customer information and results of meeting frank the tank Excel Worksheet Functions 1 February 16th 05 05:49 PM


All times are GMT +1. The time now is 06:57 PM.

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"