1

I want a user to type a text or a number into a inputbox that pops up when you click a button. I tried different methods i found on the Internet and tried to modify the codes that they work for me.

First I tried this but after i clicked OK the box disappeared and nothing happened:

Sub inputbox()

    Dim mlt As String
    Dim myString As String
    myString = ThisWorkbook.Sheets("Bericht_BOSCH").Cells(2, 6).Value
    mlt = Application.inputbox("Insert your age:")

End Sub

Then i tried to tell my code where the text from the Inputbox has to go and added 2 rows to my code:

Range("B6").Select
ActiveSheet.Paste

Now my code selects the cell B6 after I click OK but it doesn't paste the code there. Now my question: What did I do wrong? Thank you in advance!

2 Answers 2

2
Sub inputbox()
    Dim mlt As String
    Dim myString As String

    myString = ThisWorkbook.Sheets("Bericht_BOSCH").Cells(2, 6).Value
    mlt = Application.inputbox("Insert your age:")

    ActiveSheet.range("B6").value = mlt
End Sub
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much I feel a little dumb now xD. Have a nice day!!
1

You can even do it in one line:

Sub TestMe()
   ThisWorkbook.Sheets("Bericht_BOSCH").Cells(2, 6) = Application.inputbox("Insert age:")
End Sub

Comments

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.