problem in Selection of Ranges

harshab6

Active Member
Joined
Oct 1, 2008
Messages
254
Hi.
I have prepared a form which I use to autofilter certain data.there are nearly 30000 lines and I use following code
Private Sub CommandButton2_Click()
Sheets("Report").Select
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
<o:p> </o:p>
Selection.AutoFilter Field:=2, Criteria1:="=*" & TextBox3.Text & "*", Operator:=xlAnd
<o:p> </o:p>
Selection.AutoFilter Field:=3, Criteria1:="=*" & TextBox2.Text & "*", Operator:=xlAnd
<o:p> </o:p>
Selection.AutoFilter Field:=4, Criteria1:="=*" & TextBox1.Text & "*", Operator:=xlAnd
<o:p> </o:p>
Selection.AutoFilter Field:=7, Criteria1:="=*" & TextBox4.Text & "*", Operator:=xlAnd
Selection.AutoFilter Field:=8, Criteria1:="=*" & TextBox5.Text & "*", Operator:=xlAnd
Selection.AutoFilter Field:=9, Criteria1:="=*" & TextBox6.Text & "*", Operator:=xlAnd
Selection.AutoFilter Field:=18, Criteria1:="=*" & TextBox7.Text & "*", Operator:=xlAnd
Selection.AutoFilter Field:=19, Criteria1:="=*" & TextBox8.Text & "*", Operator:=xlAnd
Selection.AutoFilter Field:=20, Criteria1:="=*" & TextBox9.Text & "*", Operator:=xlAnd
Selection.AutoFilter Field:=34, Criteria1:="=*" & TextBox10.Text & "*", Operator:=xlAnd
End sub
This code only selects 21000 lines out of 30000 lines where as It need to select all 30000 lines or any number of lines the sheet contains.I am unable to figure out the problem can anyone help me with this.
<o:p> </o:p>
<o:p> </o:p>
<o:p> </o:p>
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
You can change the range to include the entire column, look here as an example.

Sub Macro1()
'
' Macro1 Macro
'
'
Range("A1").Select
Selection.AutoFilter
ActiveSheet.Range("A:A").AutoFilter Field:=1, Criteria1:= _
"What you want"
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,704
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top