So i have a database that i update it daily and i want to populate a sheet with only the tickets that had been breached. What i want to do is to check on the database and copy only the new tickets to that sheet right after the last value.
我有一个数据库,我每天更新它,我想填充一个表格,只包含被破坏的票。我要做的是检查数据库,只在最后一个值之后将新的票据复制到该表。
My code now is copying all the tickets avaiable and i wanted to change that.
我的代码现在复制了所有票,我想要改变它。
Can anyone help? Thank you
谁能帮忙吗?谢谢你!
Here is my code so far
这是我目前的代码
'SELECT DATABASE SHEET
Sheets("RAW ALL INC").Select
'FILTER ONLY THE BROKEN TICKETS
Selection.AutoFilter
ActiveSheet.Range("$A$1:$X$1312").AutoFilter Field:=4, Criteria1:="TRUE"
'COPY ALL TICKETS (THIS IS WHERE I WANT TO SELECT ONLY NEW TICKETS)
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
'PASTE THE TICKETS ON THE BROKEN TICKETS SHEET
Sheets("Broken Justification").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
1 个解决方案
#1
1
I think you can select just the visible cells after you apply your auto-filter, like this:
我想你可以只选择可见的单元格后,你应用你的自动过滤器,像这样:
Sub filtersub()
ActiveSheet.Range("$A$1:$X$1312").AutoFilter Field:=4, Criteria1:="TRUE"
Range("$A$1:$X$131").Select
'here's where you select filtered results...
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("Broken Justification").Select
Range("A2").Select
ActiveSheet.Paste
End Sub
So filter for the rows you want, then just copy them all and paste them into your destination.
所以过滤你想要的行,然后把它们全部复制并粘贴到你的目的地。
#1
1
I think you can select just the visible cells after you apply your auto-filter, like this:
我想你可以只选择可见的单元格后,你应用你的自动过滤器,像这样:
Sub filtersub()
ActiveSheet.Range("$A$1:$X$1312").AutoFilter Field:=4, Criteria1:="TRUE"
Range("$A$1:$X$131").Select
'here's where you select filtered results...
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("Broken Justification").Select
Range("A2").Select
ActiveSheet.Paste
End Sub
So filter for the rows you want, then just copy them all and paste them into your destination.
所以过滤你想要的行,然后把它们全部复制并粘贴到你的目的地。