ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   window to enter a number (https://www.excelbanter.com/excel-programming/383231-window-enter-number.html)

steven

window to enter a number
 
Hello, again an easy one.

Instead of having this code ActiveCell.FormulaR1C1 = "2" (that enters 2 in
a cell) how to I have a box (ie window ) pop up that askes me each time which
number to enter?

thank you.

Steven.

joel

window to enter a number
 
Use an Inputbox

"steven" wrote:

Hello, again an easy one.

Instead of having this code ActiveCell.FormulaR1C1 = "2" (that enters 2 in
a cell) how to I have a box (ie window ) pop up that askes me each time which
number to enter?

thank you.

Steven.


Chip Pearson

window to enter a number
 
Steven,

Use Application.InputBox. E.g.,

Dim V As Variant
V = Application.InputBox(prompt:="Enter a number.", Type:=1)
If V = False Then
Debug.Print "User clicked cancel"
Else
ActiveCell.Value = V
End If

Note that you must use Application.InputBox instead of just InputBox in
order to restrict the valid values to numbers (type:=1).


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"steven" wrote in message
...
Hello, again an easy one.

Instead of having this code ActiveCell.FormulaR1C1 = "2" (that enters 2
in
a cell) how to I have a box (ie window ) pop up that askes me each time
which
number to enter?

thank you.

Steven.





All times are GMT +1. The time now is 07:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com