Showing posts with label msgbox. Show all posts
Showing posts with label msgbox. Show all posts

Sunday, March 6, 2016

How to receive an text input from a message box in EXCEL VBA

If you want to ask the user for an input, you can create a userform or you can simply use the Inputbox() method of VBA. For example:

a = InputBox("Enter the name of the picture")






Created by DoMyExcel.com © | Excel & VBA Consulting | Customized Excel Solutions starting at 29 USD
Services provided to Individuals and Businesses | Free Quote: DoMyExcel@gmail.com

How to display all the elements of an array in a message box VBA

If you want to know what is contained in your VBA array simply use the Join method:

Join(my_array,vbCr)

Example: if you want to add the following data into an array and then display the array


Sub print_array_example()

Dim arr() As Variant

ReDim arr(1 To 5) As Variant

For i = 1 To 5
    arr(i) = Cells(i, 1)
Next
  
MsgBox Join(arr, vbCr)

End Sub


 



Created by DoMyExcel.com © | Excel & VBA Consulting | Customized Excel Solutions starting at 29 USD
Services provided to Individuals and Businesses | Free Quote: DoMyExcel@gmail.com