½Ð°Ý³o¤@¬q ¤éÂà¤ëªº¼gªkþÃ䦳°ÝÃD
¸ê®Æ©Ç©Çªº
Sub ¤éÂà¤ëK()
' **************************************************
' ¨Ï¥Î¤u§@ªí¨ç¼Æ weeknum ' §PÂ_ ¬O§_¬°¦P¤@¶gªºÀç·~¤é¸ê®Æ
' ¦ý2003ª© ¨Ï¥Î weeknum ¶·©ó¼W¯q¶°¤¤ ¥[¤JVBA¤ÀªR½c
' ©PÂà¤ëK , ¥i¥H¨Ì¼Ëµe¸¬Äª
' **************************************************
Dim rowss As Integer
' Dim rowsc As Integer
Dim Mday(1 To 2) As Variant, Rng As Range, i As Integer
If Sheets("¤u§@ªí1").Range("d6") = "" Then Exit Sub '¬G·N³]©wªº§PÂ_°Ñ¼Æ,ÁקKµL¼ÆÈÁÙpºâ
' ªÑ»ù¸ê®Æ°_©lrow
rowss = 6
With ¤u§@ªí1
' ½T»{ªÑ»ù¸ê®Æ¦³µL
If .Range("A" & rowss) = "" Then Exit Sub
' ©PKªíÀY
.Range("R" & rowss - 1 & ":W65536").Clear
.Range("R" & rowss - 1).Resize(1, 7) = Array("¤ë¼Æ", "¤é´Á", "¶}½L", "³Ì°ª", "³Ì§C", "¦¬½L", "¦¨¥æ¶q")
' .Range("L" & rowss - 1) = "¶}½L"
' .Range("M" & rowss - 1) = "³Ì°ª"
' .Range("N" & rowss - 1) = "³Ì§C"
' .Range("O" & rowss - 1) = "¦¬½L"
' .Range("P" & rowss - 1) = "¦¨¥æ¶q"
' ²Ä¤@µ§©PK§P§O¥Î
' rowsc = rowss ' ©PK°_©lrow
' .Range("K" & rowss) = .Range("A" & rowss)
' .Cells(rowsc, 11) = .Cells(rowss, 1)
' .Cells(rowsc, 13) = .Cells(rowss, 3)
' .Cells(rowsc, 14) = .Cells(rowss, 4)
i = 6
Do
Mday(1) = Evaluate("MONTH(""" & .Cells(i, 1) & """)")
Mday(2) = Evaluate("MONTH(""" & .Cells(i, 1) & """)") ' ¾É¤J¦~«×ªº¤ë¼Æ
Set Rng = .Cells(i, 1).Resize(, 8) ' ³o¤é´Áªº¸ê®Æ
Do
Set Rng = Union(.Cells(i, 1).Resize(, 8), Rng) ' ¥[¤J¦P¶g¤@¤é´Áªº¸ê®Æ
i = i + 1 ' ¤U¤@Ó ¤é´Á
Mday(2) = Evaluate("MONTH(""" & .Cells(i, 1) & """)") ' ¾É¤J¦~«×ªº¶g¼Æ
If IsError(Mday(2)) Then Exit Do ' ¨S¤é´Á ¶Ç¦^¿ù»~È
Loop Until Mday(1) <> Mday(2) ' ´«©P
' Rng.Select ' ¬Ý¬Ý¬O§_¬°¦P¤@¶g¤é´Áªº¸ê®Æ
' ¤éÂà©PK¸ê®Æ
.Range("R" & rowss).Resize(1, 7) = Array(Mday(1), Rng(Rng.Rows.Count, 1).Text, Rng(1, 2), Application.Max(Rng.Columns(3)), Application.Min(Rng.Columns(3)), Rng(Rng.Rows.Count, 5), Format(Application.Sum(Rng.Columns(8)), "000,000"))
rowss = rowss + 1 ' ¤U¤@ ¤éÂà©PK¸ê®Æ
Loop Until IsError(Mday(2))
End With
End Sub |