Syntax:
InputBox(prompt, [title], [default], [xpos], [ypos], [HelpFile], [Context]) as string Follow the below steps to create a button and display the name in excel using input box method.Step 1:
Create a button in excel to display the name in cell "C4" as shown in the below picture.
Step 2:
Right click on the button and click view code to get into VBA Editor mode. Copy the below code and paste it in that VBA editor.
Private Sub CommandButton1_Click()
Dim My_Input_Value As Variant
My_Input_Value = InputBox("Enter Your Name", "InputBox Method")
Range("C4").Value = My_Input_Value
End Sub
Dim My_Input_Value As Variant
My_Input_Value = InputBox("Enter Your Name", "InputBox Method")
Range("C4").Value = My_Input_Value
End Sub
No comments:
Post a Comment