0

im trying to record a user input which is a list of words separated by commas. Which i need to store as an array. Here is my attempt, but i am not too good at this. Thanks!

    Dim arWords() As String
    myt = InputBox("Enter User Input")
    arWords() = Split(myt, ",")
        For X = 0 To UBound(arWords())
        myf = myf & arWords(X) & vbCr
    Next X
6
  • 1
    arWords is the array, since Split returns an array. Where else are you stuck? Commented Aug 12, 2021 at 14:17
  • Sometimes ... We just need to rub our eyes and look at the code again. Oops! Thank you! Commented Aug 12, 2021 at 14:23
  • 1
    @kyle It looks like you are trying to change , to next line, can't you just do Replace(myt,",",vbCr)? Commented Aug 12, 2021 at 15:02
  • 3
    I suggest using vbNewLine instead of vbCr. The former is OS-independent. Commented Aug 12, 2021 at 15:04
  • Does this answer your question? VBA issue - storing data in array from inputbox Commented Aug 12, 2021 at 16:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.