(Solved) – How do I get the Input from ActiveX InputBox in Excel to be in my VBA code?


I’m trying to make a user data entry sheet in Excel so it can filter out the database from the other worksheet, however, I don’t know how to take the data that I get from this entry sheet to be use and saved in my VBA code.

Here’s my data entry sheet:

enter image description here

What I’m trying to do is to replace the Pop-up InputBox from this code and replace the input from the data entry sheet. This is the previous code:

Sub InputFilter()

    Dim strInput As String
    Dim strInput1 As String
    Dim strInput2 As String

        ActiveSheet.AutoFilterMode = False
        strInput = InputBox("Enter your value to filter WPP")
        ActiveSheet.Range("$A$4:$BL$351").AutoFilter Field:=8, Criteria1:=strInput 'User Input for desired WPP

        strInput1 = InputBox("Enter your Product Category")
        ActiveSheet.Range("$A$4:$BL$351").AutoFilter Field:=6, Criteria1:=strInput1 'User Input for Product Category


And turn it into something like this, but It keeps throwing 438 error and the data from the entry sheet doesn’t want to replace the strInput

Sub test()

ActiveSheet.AutoFilterMode = False
ActiveWorkbook.Worksheets("Raw Data Domestic").strInput = ActiveSheet("Sheet").txtWPP.Value
ActiveSheet("Raw Data Domestic").Range("$A$4:$BL$351").AutoFilter Field:=8, Criteria1:=strInput

End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *