Search notes:

Office Object Model: Excel - Application.inputBox

inputBox() lets the user enter different values or range.

Entering basic types

With the type parameter set to 1, 2 or 4, application.inputBox allows to enter numbers, strings or booleans.
option explicit

sub main() ' {

    dim num as double
    dim txt as string
    dim bol as boolean

    num = application.inputBox("Enter a number" , "Example", type := 1) : debug.print("num = " & num)
    txt = application.inputBox("Enter a string" , "Example", type := 2) : debug.print("txt = " & txt)
    bol = application.inputBox("Enter a boolean", "Example", type := 4) : debug.print("bol = " & bol)

end sub ' }
Github repository about-MS-Office-object-model, path: /Excel/Application/inputBox/number-string-boolean.bas

Entering ranges

With type := 8, inputBox lets the user enter a range by selecting it with the mouse (and then process the range in the VBA code).
option explicit

sub main() ' {

    dim rng as range

    set rng = application.inputBox("Enter a range"  , "Example", type := 8)

    debug.print("The entered range is: " & rng.address)

end sub ' }
Github repository about-MS-Office-object-model, path: /Excel/Application/inputBox/range.bas

See also

The VBA function msgBox() and inputBox()

Index