98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Multiple Userform Inputs
Multiple Userform Inputs
Resolved · Low Priority · Version 2010
Rebecca has attended:
Excel VBA Introduction course
Excel VBA Intermediate course
Multiple Userform Inputs
Hi,
I am currently trying to create some VBA code that allows the user to input multiple inputs (e.g. "2,78,91") which can then be used individually to autofilter for those values in a column.
For one value my code currently is;
StageNo = InputBox("Enter Stage Numbers to Compare", "Enter Stage Number")
For i = 1 To nooftests
Sheets("DataSet" & i).Select
Rows("5:5").Select
Selection.AutoFilter
ActiveSheet.Range("$A$5:$AJB$24117").AutoFilter Field:=3, Criteria1:=StageNo
Next I
I now want the inputbox for StageNo to be able to be put in as 2,78,91 and then the filter to filter for each of these three values.
Thanks for your help!
RE: Multiple Userform Inputs
Hi Rebecca,
Thank you for the forum question.
I am using an array (arr_TotalList). I split the entered values each time there is a comma and store each value in the array.
Sub FilterMultiple()
Dim arr_TotalList As Variant
Dim StageNo As Variant
StageNo = InputBox("Enter Stage Numbers to Compare", "Enter Stage Number")
arr_TotalList = Split(StageNo, ",")
ActiveSheet.Range("$A$5:$AJB$24117").AutoFilter Field:=3, Criteria1:=arr_TotalList
End Sub
I hope this can do what you want.
Kind regards
Jens Bonde
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Formst Excel to display leading zeroesSelect the cells that you want to have displaying leading zeroes. |