Dear All,
I am using an input box to get the user input. With the user input, I am setting autofilter criteria. Here is the code:
Dim SelSeg As String
ActiveWorkbook.Sheets("Jan 2015").Activate
Range("a1").Select
SelSeg = InputBox("Please enter name of segments for which you are looking for stories. For all segment, leave the input blank ")
If (SelSeg <> "") Then
Rows("1:1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$AE$7").AutoFilter Field:=1, Criteria1:="" & SelSeg & ""
Else
ActiveSheet.Range("$A$1:$AE$7").AutoFilter Field:=1
End If
End Sub
Now, I would like to offer user form so that the user can select the input from the drop down box in the form. Also, the list in dropbox should be from Range A1:A4 (or last row of the Coloum A.
I have tried following code which does not work
ActiveWorkbook.Sheets("Jan 2015").Activate
Range("a1").Select
Myform.Show
Myform.AAA.List = Worksheets("Jan 2015").Range("a2:a5").Value
SelSeg = Myform.AAA.Value
If (SelSeg <> "") Then
Rows("1:1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$AE$7").AutoFilter Field:=1, Criteria1:="" & SelSeg & ""
Else
ActiveSheet.Range("$A$1:$AE$7").AutoFilter Field:=1
End If
End Sub
Please help: thanking you in advance
BR
haplc
I am using an input box to get the user input. With the user input, I am setting autofilter criteria. Here is the code:
Dim SelSeg As String
ActiveWorkbook.Sheets("Jan 2015").Activate
Range("a1").Select
SelSeg = InputBox("Please enter name of segments for which you are looking for stories. For all segment, leave the input blank ")
If (SelSeg <> "") Then
Rows("1:1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$AE$7").AutoFilter Field:=1, Criteria1:="" & SelSeg & ""
Else
ActiveSheet.Range("$A$1:$AE$7").AutoFilter Field:=1
End If
End Sub
Now, I would like to offer user form so that the user can select the input from the drop down box in the form. Also, the list in dropbox should be from Range A1:A4 (or last row of the Coloum A.
I have tried following code which does not work
ActiveWorkbook.Sheets("Jan 2015").Activate
Range("a1").Select
Myform.Show
Myform.AAA.List = Worksheets("Jan 2015").Range("a2:a5").Value
SelSeg = Myform.AAA.Value
If (SelSeg <> "") Then
Rows("1:1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$AE$7").AutoFilter Field:=1, Criteria1:="" & SelSeg & ""
Else
ActiveSheet.Range("$A$1:$AE$7").AutoFilter Field:=1
End If
End Sub
Please help: thanking you in advance
BR
haplc