Stormseed
Banned
- Joined
- Sep 18, 2006
- Messages
- 3,274
Hi !
please tell me what am I doing wrong in this program ?
VBA Code:
Execution of this code with all the worksheets visible works fine. However, if I make a worksheet (any one from sec1 to sec5) hidden or veryhidden then it throws a Debug Error "Select method of Sheets class failed" ??
Any idea why am I getting this and why am I supposed to hide these sheets before trigerring the macro ?
thanks a lot for your time
please tell me what am I doing wrong in this program ?
VBA Code:
Code:
Sub FilterCopy()
Application.ScreenUpdating = False
Sheets(Array("sec1", "sec2", "sec3", "sec4", "sec5")).Select
Cells.Select
Selection.ClearContents
Sheets("Raw Data").Activate
[A1:m1000].AutoFilter Field:=1, Criteria1:="194A"
[A1:m1000].Copy Sheets("sec1").[a1]
[A1:m1000].AutoFilter Field:=1, Criteria1:="194C"
[A1:m1000].Copy Sheets("sec2").[a1]
[A1:m1000].AutoFilter Field:=1, Criteria1:="194I"
[A1:m1000].Copy Sheets("sec3").[a1]
[A1:m1000].AutoFilter Field:=1, Criteria1:="194J"
[A1:m1000].Copy Sheets("sec4").[a1]
[A1:m1000].AutoFilter Field:=1, Criteria1:="195"
[A1:m1000].Copy Sheets("sec5").[a1]
[A1:m1000].AutoFilter
Application.ScreenUpdating = True
End Sub
Execution of this code with all the worksheets visible works fine. However, if I make a worksheet (any one from sec1 to sec5) hidden or veryhidden then it throws a Debug Error "Select method of Sheets class failed" ??
Any idea why am I getting this and why am I supposed to hide these sheets before trigerring the macro ?
thanks a lot for your time