Multiple selection for Filter userform

Status
Not open for further replies.

rajeshn_in

New member
Joined
Apr 6, 2016
Messages
5
Reaction score
0
Points
0
Hi Friends,

I am using below vba to get filtered data in to another sheet. but i am not able to select multiple cells to get data.

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


Sub formshow()
'Show Search Form
UserForm1.Show
End Sub



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

Thank you Friends,
 

AliGW

Administrator
Joined
Nov 8, 2015
Messages
1,800
Reaction score
4
Points
38
Location
Ipswich, Suffolk, England
Excel Version(s)
MS 365 (Beta Insider Channel)
Cross-posting Without Links

Your post does not comply with our Forum RULES. Do not cross-post your question on multiple forums without including links here to the other threads on other forums.

Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

Please supply the cross-post link(s) immediately.
 

Pecoflyer

Admin Alumnus
Joined
Oct 13, 2011
Messages
1,779
Reaction score
0
Points
36
Location
Brussels Belgium
Excel Version(s)
2010 on Xubuntu - O365
"I don't care about cross posting etiquette"

@rajesh
This is at least the third time you cross post a thread without adding the links as requested.
As you do not seem to care about rules and courtesy, I see no reason why our members would waste their time for you and thus I will close this thread
I am leaving you a lest chance. If you want to post again , add the links to cross posts (or don't cross post) otherwise I will ban you
 
Status
Not open for further replies.
Top