sspatriots
Well-known Member
- Joined
- Nov 22, 2011
- Messages
- 585
- Office Version
- 365
- Platform
- Windows
Hi,
I'm not sure if the bit of code below is enough to get the help I need or not. The code is extremely long, and I can post more of it if needed. This bit basically copies a filtered portion of one column in one table to a second table in another worksheet. Trying to figure out how to re-write this and avoid having to activate "ws2" if possible. Right now as it stands, when I remove the ws2 activate line, the destination table doesn't populate the information in the destination table on the second worksheet. Thanks, SS
I'm not sure if the bit of code below is enough to get the help I need or not. The code is extremely long, and I can post more of it if needed. This bit basically copies a filtered portion of one column in one table to a second table in another worksheet. Trying to figure out how to re-write this and avoid having to activate "ws2" if possible. Right now as it stands, when I remove the ws2 activate line, the destination table doesn't populate the information in the destination table on the second worksheet. Thanks, SS
VBA Code:
'Safety
EQPT3:
' ws1.Activate
ws1.ListObjects("G2JobList").Range.AutoFilter 'Clear previous filters
ws1.ListObjects("G2JobList").Range.AutoFilter Field:=col99, Criteria1:="<>"
ws1.ListObjects("G2JobList").Range.AutoFilter Field:=col5, Criteria1:="="
ws1.ListObjects("G2JobList").Range.AutoFilter Field:=col6, Criteria1:=">=" & Date, Operator:= _
xlAnd, Criteria2:="<=" & Date + 28
With tb1
On Error GoTo EQPT4
If ws1.Range("G2JobList[[#All],[Job Name]]").SpecialCells(xlCellTypeVisible).Count > 1 Then
ws1.Range("G2JobList[[Job Name]]").SpecialCells(xlCellTypeVisible).Copy
ws2.Activate
With ws2.Range("Order_By_Report[[Job Name]]")
n = Columns(.Column).Resize(, .Columns.Count).Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Cells(n + 1, .Column).PasteSpecial xlPasteValues
End With
End If
End With 'Temporary
'Governor 'Temporary
EQPT4: 'Temporary