Only filters if month in col J
Sub clearsheets()
For Each ws In Worksheets
If UCase(ws.Name) < "MAIN" Then ws.Rows("5:1000").ClearContents
Next
End Sub
Sub filterbymonthandcopytosheetsSAS()
Application.ScreenUpdating = False
clearsheets
Range("b4") = 0
lr = Cells(Rows.Count, "b").End(xlUp).Row
For i = 5 To lr
Cells(i, "J").Value = Month(Cells(i, 2))
Next i
With Range("a2:j" & lr)
For i = 1 To 12
If Application.CountIf(Columns("j"), i) 0 Then
.AutoFilter Field:=10, Criteria1:=i
Range(Cells(5, "b"), Cells(lr, "i")).Copy
With Sheets(CStr(i)).Range("b5")
.PasteSpecial Paste:=xlPasteFormats
.PasteSpecial Paste:=xlPasteValues
End With
End If
Next i
.AutoFilter
End With
Columns("j").ClearContents
Application.ScreenUpdating = True
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"tofimoon4" wrote in message
...
Dear sir,with my apology,i found after some expriences that the sheets
(6,7,8,10) which i coloured in yellow in attached file have a mistake.
Asking you kindly to take a look and modify.
thanks in advance.
+-------------------------------------------------------------------+
|Filename: Transferring1.zip |
|Download:
http://www.thecodecage.com/forumz/attachment.php?attachmentid=146|
+-------------------------------------------------------------------+
--
tofimoon4
------------------------------------------------------------------------
tofimoon4's Profile:
http://www.thecodecage.com/forumz/member.php?userid=138
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=100128