Hi All, I'm using the following code to filter the cells and then copy the filtered values. The code seems to be working for Sti but when I use it for Mon, the whole sheet data copies. Kindly help me identify what I'm doing wrong over here
This is what my data looks like:
[TABLE="width: 355"]
<tbody>[TR]
[TD]order_no
[/TD]
[TD]merchant_name[/TD]
[/TR]
[TR]
[TD="align: right"]101[/TD]
[TD]Mon[/TD]
[/TR]
[TR]
[TD="align: right"]102[/TD]
[TD]Sti[/TD]
[/TR]
</tbody>[/TABLE]
This is what my data looks like:
[TABLE="width: 355"]
<tbody>[TR]
[TD]order_no
[/TD]
[TD]merchant_name[/TD]
[/TR]
[TR]
[TD="align: right"]101[/TD]
[TD]Mon[/TD]
[/TR]
[TR]
[TD="align: right"]102[/TD]
[TD]Sti[/TD]
[/TR]
</tbody>[/TABLE]
Code:
Sub Macro1()
Range("A1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$B$1000").AutoFilter Field:=2, Criteria1:= _
"Mon*"
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("A2:A" & LR).SpecialCells(xlCellTypeVisible).Select
Selection.Copy
End Sub