Friday, 25 May 2018

Input Box Type in VBA

If you trying to fetch an Inputbox question and you want user to be restricted based on some type of question, you can set the following

 

InputBox(Prompt[,Title][,Default][,x][,y][,HelpFile][,HelpContextId][,Type])

 

where Type specifies the return data type:

 

Type Values

0

Formula

1

Number

2

Text (String)

4

Logical value (True or False)

8

Cell reference (Range object)

16

Error value

64

Array of values

 

Eg : Set address

 

 

Set rInput = Application.InputBox _

            (Prompt:="Enter the Column Number Input Cell like R1 etc :", _

            Title:="Row Input Cell", _

            Type:=8)

 

    sAddress = rInput.Address