ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Input box and assigning to a variable. (https://www.excelbanter.com/excel-programming/385421-input-box-assigning-variable.html)

Vijay Kotian

Input box and assigning to a variable.
 
In Excel Programming, I want the user to punch in the field through input box
and the same is assigned to a variable. I don't know to use input box how can
i do that? and please inform me to assigning to a variable.

Bob Flanagan

Input box and assigning to a variable.
 
dim anyR as range
on error resume next
set anyR = application.inputbox("select a range", type:=8)
if anyR is nothing then exit sub

Bob Flanagan
Macro Systems
144 Dewberry Drive
Hockessin, Delaware, U.S. 19707

Phone: 302-234-9857, cell 302-584-1771
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Vijay Kotian" wrote in message
...
In Excel Programming, I want the user to punch in the field through input
box
and the same is assigned to a variable. I don't know to use input box how
can
i do that? and please inform me to assigning to a variable.




stevebriz

Input box and assigning to a variable.
 
On Mar 16, 9:03 am, Vijay Kotian
wrote:
In Excel Programming, I want the user to punch in the field through input box
and the same is assigned to a variable. I don't know to use input box how can
i do that? and please inform me to assigning to a variable.


here is another simple example

Sub test()
ans = InputBox(" Enter Data here", "My Input Box")
MsgBox ans

End Sub



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

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