- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2015-7-24 06:21 ½s¿è
¦^´_ 14# finally0130
¸Õ¸Õ¬Ý
²Ä6©«Àɮתºµ{¦¡½X- Option Explicit
- Dim x_Mon As Integer, x_Week As Integer
- Sub Ex()
- Dim R As Long, E As Variant, t As Date
- t = Time
- Range("F4:Z" & Rows.Count) = "" '²M°£Â¦³¸ê®Æ Rows.Count ½d³òªº¦CÁ`¼Æ,³o¸Ì¬°¤u§@ªí½d³ò
-
- R = Range("D4").End(xlDown).Row '¤é¥§¡»ùªº³Ì«á¤@¦C¸¹
- With Range("B4:B" & R) '¤ë§O½d³ò
- .Cells = "=MONTH(RC[2])" '¤u§@ªí¤W¼g¤J¨ç¼Æ,[R1C1]¤u§@ªí¤WÄæ¦W¦C¦Wªí¥Üªk
- .Value = .Value '¤½¦¡ÂàÈ
- End With
- With Range("C4:C" & R) '©P§O½d³ò
- .Cells = "=WEEKNUM(RC[1])" '2003: ¼W¯q¶°¶·¥[¤J VBA¤ÀªR¤u¨ã½c
- .Value = .Value
- End With
- x_Week = DatePart("ww", Range("D4")) 'VBAªº¶g§O¨ç¼Æ
- x_Mon = Month(Range("D4")) 'VBAªº¤ë§O¨ç¼Æ
-
- For Each E In Range("D4:D" & R) '¤é´Á½d³ò
- ¶g¤ë¦¬½L»ù E '©I¥s Sub ¶g¤ë¦¬½L»ù E(¶Ç»¼°Ñ¼Æ)
- x_Week = DatePart("ww", E) '¦AŪ·í¶g
- x_Mon = Month(E) '¦AŪ·í¤ë
- Next
- §¡»ù '©I¥s Sub §¡»ù
- MsgBox Application.Text(Time - t, "¦@p°õ¦æ [s] ¬í")
- End Sub
- Sub §¡»ù()
- Dim Rng As Range, E As Variant, i As Integer, AR()
- AR = Array(5, 10, 20, 60, 120)
- For Each E In Array("F4", "N4", "V4") '¤é¥§¡»ù,©P¥§¡»ù,¤ë¥§¡»ùªº²Ä¤@ÓÄæ¦ì
- Set Rng = Range(E).Resize(Range(E).Offset(, -1).End(xlDown).Row - 3, 5)
- For i = 0 To UBound(AR)
- With Rng.Columns(i + 1) '§¡»ù½d³òªº¨C¤@ÓÄæ¦ì½d³ò
- If .Rows.Count > AR(i) Then '½d³ò¤p©ó§¡»ù¤é¼Æ ¤U±ªºWith·|¦³¿ù»~
- With .Cells(AR(i)).Resize(.Rows.Count - AR(i) + 1)
- .Cells = "=Average(RC[" & -i + -1 & "]:R[" & -AR(i) + 1 & "]C[" & -i + -1 & "])"
- '¤u§@ªí¤W¼g¤J¤½¦¡
- End With
- End If
- End With
- Next
- Rng.Value = Rng.Value 'Âऽ¦¡¬°È
- Next
- End Sub
- Sub ¶g¤ë¦¬½L»ù(E As Variant) 'Ū¨ú¨ì:©P¦¬½L»ù,¤ë¦¬½L»ù
- If x_Week <> DatePart("ww", E) Then '¤£¦P¶g¼Æ
- With Range("L" & Rows.Count).End(xlUp).Offset(1)
- .Resize(, 2) = E.Offset(-1).Resize(, 2).Value 'Eªº¤W¤@¦C
- .Cells(1, 0) = DatePart("ww", E.Offset(-1))
- End With
- End If
- If x_Mon <> Month(E) Then '¤£¦P¤ë¼Æ
- With Range("T" & Rows.Count).End(xlUp).Offset(1)
- .Resize(, 2) = E.Offset(-1).Resize(, 2).Value
- .Cells(1, 0) = Month(E.Offset(-1))
- End With
- End If
- End Sub
½Æ»s¥N½X |
|