DenniBrink
New Member
- Joined
- Jul 31, 2016
- Messages
- 46
Hello everyone! I need another dose of Mr. Excel brilliance. I am trying to develop a subroutine that will autofilter, copy, and paste columns of data from one worksheet to another. Below is an example of a table (sht: "Master Daily Sched") I want to autofilter with the string criteria1:="NS".
B C D E F G H I
<tbody>
</tbody>
The following is an example of VBS script I am trying to revise:
Sub SATFILTER()
' SATFILTER Macro
' Filters Master Daily Schedule Worksheet for Employees Assigned to Work Saturday.
Application.ScreenUpdating = False
Sheets("SAT_ASSIGNMENTS").Select
Range("B8:C38").Clear
Sheets("MASTER DAILY SCHED").Select "THIS AREA NEEDS REVISING; ERROR HANDLING OCCURS"
ActiveSheet.Range("$C$4:$I$56").AutoFilter Field:=1, Criteria1:=Array( _ "I believe this should be define as a string = "NS"
"3003/3009", "3070/3017", "3070/3086", "3087/3088/3089", "3090/3091", "3092/3093", _
"AFCS", "AFSM", "APPS #1", "APPS #2", "DBCS", "E. Battery Rm", "FSS", "SPSS/APBS"), _
Operator:=xlFilterValues
Range("B8:C56").Select
Selection.Copy
Sheets("SAT_ASSIGNMENTS").Select "Problem Here; Error Handling Occurs"
Range("B8").Select
ActiveSheet.Paste
Sheets("MASTER DAILY SCHED").AutoFilterMode = False
Sheets("SAT_ASSIGNMENTS").Select
Application.ScreenUpdating = True
End Sub
B C D E F G H I
Name | Sat | Sun | Mon | Tue | Wed | Thu | Fri |
Bob | NS | NS | Clean | Inspect | Build | Inspect | Clean |
Richard | Clean | NS | NS | Clean | Inspect | Build | Inspect |
<tbody>
</tbody>
The following is an example of VBS script I am trying to revise:
Sub SATFILTER()
' SATFILTER Macro
' Filters Master Daily Schedule Worksheet for Employees Assigned to Work Saturday.
Application.ScreenUpdating = False
Sheets("SAT_ASSIGNMENTS").Select
Range("B8:C38").Clear
Sheets("MASTER DAILY SCHED").Select "THIS AREA NEEDS REVISING; ERROR HANDLING OCCURS"
ActiveSheet.Range("$C$4:$I$56").AutoFilter Field:=1, Criteria1:=Array( _ "I believe this should be define as a string = "NS"
"3003/3009", "3070/3017", "3070/3086", "3087/3088/3089", "3090/3091", "3092/3093", _
"AFCS", "AFSM", "APPS #1", "APPS #2", "DBCS", "E. Battery Rm", "FSS", "SPSS/APBS"), _
Operator:=xlFilterValues
Range("B8:C56").Select
Selection.Copy
Sheets("SAT_ASSIGNMENTS").Select "Problem Here; Error Handling Occurs"
Range("B8").Select
ActiveSheet.Paste
Sheets("MASTER DAILY SCHED").AutoFilterMode = False
Sheets("SAT_ASSIGNMENTS").Select
Application.ScreenUpdating = True
End Sub