ExcelでVBAを使用してInputBoxを返すかどうかを決定する方法


この記事では、マイクロソフトExcelでVBA * *を使用してInputBoxを返す方法を決定する方法をご案内します.下にしましょう!次のリンクからMS Excelの公式バージョンを入手してくださいhttps://www.microsoft.com/en-in/microsoft-365/excel

  • まず、Excelのワークシートでは、[開発]タブに移動する必要があります.
  • 次に、コードセクションの下のVisual Basicオプションを選択する必要があります.
  • 選択します
  • さて、以下のコードをコピーしてペーストしなければなりません.
  • Sub DecideUserInput()
    Dim bText As String, bNumber As Integer
        ' here is the INPUTBOX-function :
        bText = InputBox("Insert in a text", "This accepts any input")
        ' here is the INPUTBOX-method :
        bNumber = Application.InputBox("Insert a number", "This accepts numbers only", 1)
        MsgBox "You have inserted :" & Chr(13) & _
            bText & Chr(13) & bNumber, , "Result from INPUT-boxes"
    End Sub
    
    
  • その後、選択してコードを保存し、ウィンドウを閉じる必要があります.
  • コードを保存する
  • 再度、Excelのスプレッドシートに移動し、[開発]タブをクリックします.
  • コードセクションでマクロオプションを選択する必要があります.
  • マクロオプションの選択
  • ここで、マクロ名が選択されていることを確認し、* Run *ボタンをクリックします.
  • コードを実行する
  • マクロを実行した後、入力ダイアログボックスが表示されます.
  • インプットダイアログボックス
  • 次の入力を入力ダイアログボックスに入力する必要があります.
  • **Accepted input:**
    0 A formula
    1 A number
    2 Text
    4 A logical value (True or False)
    8 A cell reference, e.g. a Range-object
    16 An error value, e.g. #N/A
    64 An array of values
    
    テキストを挿入する
  • 最後に、挿入されたテキストを挿入します.
  • 出力1
    出力2

    短い要約
    ここでは、マイクロソフトExcelでVBAを使用してどのような入力ボックスを返すかを決定する方法についてのステップバイステップの手順を説明しました.これを利用しなさい.以下のコメント欄であなたの価値あるフィードバックを共有してください.詳細については、当社のウェブサイトをチェックアウトGeek Excel !!
    更なる参照
  • Excel VBA InputBox Function in Office 365 With Examples!!
  • How to find Vlookup and Return the Matching Values from Multiple Worksheets?
  • Lookup a Value and Return a Different Cell From the Table in Excel!!
  • Formula to find Vlookup & Return Matching Values from Multiple worksheet
  • Excel VBA Date And Time Function in Office 365 ~ Easy Tutorial!!