multiple userform inputs
RH

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Multiple Userform Inputs

Multiple Userform Inputs

resolvedResolved · 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 courses

 

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
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Formst Excel to display leading zeroes

Select the cells that you want to have displaying leading zeroes.

From the 'Format' menu select 'Cells' (Or Right-click on the selected range and and select 'Format Cells').

In the 'Number' tab click on 'Custom' in the 'Category' window.

In the 'Type:' box enter zeroes that correspond to the size of the required number (eg 5 zeroes).

Click OK.

When you enter numbers into these cells, leading zeroes will be displayed.

eg 123 = 00123

View all Excel hints and tips


Server loaded in 0.06 secs.