ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add an asteric and let user input a number (https://www.excelbanter.com/excel-programming/441893-add-asteric-let-user-input-number.html)

Billy[_6_]

Add an asteric and let user input a number
 
In Excel 2003, i would like to be able to edit cells, specifically, by
adding to the end of a cell entry
an asteric, and then have an Input box for the user to enter a number.
Example, if the active cell's contents were "Apples 5", and the
macro invoked, an input box would appear, and, if the user entered
"3" in the box, the cell contents would now read " Apples 5*3". The
input should be restricted to numbers, such as "3" or "22" or
"2.25" or 0.333, etc.

Thank you very much,

Tonso

Rick Rothstein

Add an asteric and let user input a number
 
Give this macro a try (change the prompt and title in the InputBox to
whatever text you would like them to display)...

Sub AddAsteriskNumber()
Dim Answer As Variant
Answer = Application.InputBox("Number to use?", "Get Number", Type:=1)
If TypeName(Answer) = "Boolean" Then Exit Sub
ActiveCell.Value = ActiveCell.Value & "*" & Answer
End Sub

--
Rick (MVP - Excel)



"Billy" wrote in message
...
In Excel 2003, i would like to be able to edit cells, specifically, by
adding to the end of a cell entry
an asteric, and then have an Input box for the user to enter a number.
Example, if the active cell's contents were "Apples 5", and the
macro invoked, an input box would appear, and, if the user entered
"3" in the box, the cell contents would now read " Apples 5*3". The
input should be restricted to numbers, such as "3" or "22" or
"2.25" or 0.333, etc.

Thank you very much,

Tonso



Billy[_6_]

Add an asteric and let user input a number
 
On Apr 21, 12:49*pm, "Rick Rothstein"
wrote:
Give this macro a try (change the prompt and title in the InputBox to
whatever text you would like them to display)...

Sub AddAsteriskNumber()
* Dim Answer As Variant
* Answer = Application.InputBox("Number to use?", "Get Number", Type:=1)
* If TypeName(Answer) = "Boolean" Then Exit Sub
* ActiveCell.Value = ActiveCell.Value & "*" & Answer
End Sub

--
Rick (MVP - Excel)

"Billy" wrote in message

...



In Excel 2003, i would like to be able to edit cells, specifically, by
adding to the end of a cell entry
an asteric, and then have an Input box for the user to enter a number.
Example, if the active cell's contents were * *"Apples * 5", and the
macro invoked, an input box would appear, and, if the user entered
"3" in the box, the cell contents would now read " Apples * 5*3". The
input should be restricted to numbers, such as * "3" or "22" *or
"2.25" or 0.333, etc.


Thank you very much,


Tonso- Hide quoted text -


- Show quoted text -


Rick,

Thank you so much! I had no idea how to accomplish this! You made it
look so easy.

Thank again for your expert help!

Tonso


All times are GMT +1. The time now is 06:05 AM.

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