Hi friends,
Using below code I am getting one cell information, how can I get multiple cells information.
Code
Function FilterAndCopy(rng As Range, Choice As String)
'Clear Contents to show just new search data
Worksheets("Plant Sheet").Range("A12:BZ50").ClearContents
'Set the column to filter (In This Case 1 or A)
'Change as required
With Sheets("1. Data Entry")
rng.AutoFilter Field:=1, Criteria1:=Choice
Range("B1:B500").SpecialCells(xlCellTypeVisible).Copy Destination:=Sheets("Plant Sheet").Range("A13")
End With
On Error Resume Next
Sheets("1. Data Entry").ShowAllData
On Error GoTo 0
' Worksheets("Plant Sheet").Select
' Range("A12").Select
Call TurnAutoFilterOn
End Function
Option Explicit
Private Sub CommandButton1_Click()
Dim rng As Range
'Set Error Handling
On Error GoTo ws_exit:
Application.EnableEvents = False
'Set Range
Set rng = ActiveSheet.ListObjects("Table112").Range
'Cancel if no value entered in textbox
If TextBox1.Value = "" Then GoTo ws_exit:
'Call function Filterandcopy
FilterAndCopy rng, TextBox1.Value
rng.AutoFilter
'Exit sub
ws_exit:
Set rng = Nothing
Application.EnableEvents = True
Unload Me
End Sub
Private Sub CommandButton2_Click()
'Cancel Button
Unload Me
End Sub
Private Sub UserForm_Click()
End Sub
Display More
Thank you Friends.