pleasehelpthischick
New Member
- Joined
- Mar 1, 2023
- Messages
- 9
- Office Version
- 2016
- Platform
- Windows
I have a spreadsheet with a ton of data that I need to filter based on questions the user needs to answer. I already have a pop-up working that asks a yes or no question. If the answer is yes, it filters the right data and we are good. However, if the answer is no, I need another question to pop-up which asks them to select high, medium, or low. Columns H, I, J are high, medium, low respectively. Based on each selection, I will need those columns filtered.
Example:
User hits a button and it asks "is this important?"
User hits yes, everything filters fine.
User hits no, then should be asked "is this high, medium, low?"
If the user selects high, column H will filter to only show the value of High that is in the cell. (The rows only contain either blank or high)
If the user selects low, column I will filter to only show the value of Low that is in the cell. (The rows only contain either blank or low)
The same for the medium option.
Only one selection can be made, high medium or low.
This is the code I have so far that is working:
Sub User_Question()
Dim answer As Integer
answer = MsgBox("Is this system important?", vbQuestion + vbYesNo + vbDefaultButton2, "")
If answer = vbYes Then
ActiveSheet.ListObjects("Table22").Range.AutoFilter Field:=1, Criteria1:= _
"Yes"
Else
ActiveSheet.ListObjects("Table22").Range.AutoFilter Field:=1, Criteria1:= _
"No"
End If
End Sub
Example:
User hits a button and it asks "is this important?"
User hits yes, everything filters fine.
User hits no, then should be asked "is this high, medium, low?"
If the user selects high, column H will filter to only show the value of High that is in the cell. (The rows only contain either blank or high)
If the user selects low, column I will filter to only show the value of Low that is in the cell. (The rows only contain either blank or low)
The same for the medium option.
Only one selection can be made, high medium or low.
This is the code I have so far that is working:
Sub User_Question()
Dim answer As Integer
answer = MsgBox("Is this system important?", vbQuestion + vbYesNo + vbDefaultButton2, "")
If answer = vbYes Then
ActiveSheet.ListObjects("Table22").Range.AutoFilter Field:=1, Criteria1:= _
"Yes"
Else
ActiveSheet.ListObjects("Table22").Range.AutoFilter Field:=1, Criteria1:= _
"No"
End If
End Sub