Excel VBA Application.InputBox - Code included

Опубликовано: 29 Сентябрь 2024
на канале: EverydayVBA
6,838
34

Grab the Free VBA Quick Reference Guide
https://chrisjterrell.com/p/getting-s...
Displays a dialog box for user input. Returns the information entered in the dialog box.

This is a better version of the Standard VBA inputBox and works on Excel Version 2013 and later. It has some nice additional features like input type

Code
'https://msdn.microsoft.com/en-us/libr...
Sub AppInputbox()

Dim f As Variant '0 = Formula
Dim num As Double '1 = Number
Dim s As String '2 = String
Dim tf As Boolean '4 = Boolean
Dim rng As Range '8 = Range
Dim oarray As Variant '64 = Array Of Values

'Cells(10, 3) = Application.InputBox("Formula", "Application.Input", Type:=0)

'Cells(11, 3) = Application.InputBox("Number", "Application.Input", Type:=1)

Cells(12, 3) = Application.InputBox("String", "Application.Input", Type:=2)

Cells(13, 3) = Application.InputBox("Boolean", "Application.Input", Type:=4)

Set rng = Application.InputBox("Range", "Application.Input", Type:=8)

Cells(14, 3) = rng.Address

oarray = Application.InputBox("Select Cells", "Application.Input", Type:=64)

Stop

End Sub