- ©«¤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 ©ó 2018-1-8 21:40 ½s¿è
¦^´_ 2# av8d
°Ñ¦Ò¬Ý¬Ý- Option Explicit
- Sub Ex()
- Dim i As Integer, ½üȪí(), x As Integer
- Dim xDay As Date, xWeek()
- Xy:
- On Error Resume Next
- xDay = DateSerial(InputBox("¿é¤J¦~¥÷", , Year(Date)), 1, 1)
- If Err > 0 Then
- If MsgBox("¦~¥÷??? : «·s¿é¤J? ", vbOKCancel) = vbCancel Then
- Exit Sub
- Else
- GoTo Xy
- End If
- End If
- On Error GoTo 0
- xWeek = Array("¬P´Á¤é", "¬P´Á¤@", "¬P´Á¤G", "¬P´Á¤T", "¬P´Á¥|", "¬P´Á¤", "¬P´Á¤»")
- With Sheets("½üȤHûªí")
- ½üȪí = .Range("B1", .Range("B1").End(xlDown).Address).Value
- ½üȪí = Application.WorksheetFunction.Transpose(½üȪí)
- End With
-
- With Cells
- .Clear
- .Range("B1") = Year(xDay) & "¦~"
- .Range("B2") = "½üȤHû"
- .HorizontalAlignment = xlCenter
- .Font.Size = 22
- End With
- i = 1
- Do
- With Range("c" & i).Resize(, 7)
- .Cells(1) = Month(xDay)
- .Merge
- .NumberFormatLocal = "0""¤ë""""¥÷"""
- .Offset(1).Resize(, 7) = xWeek
- End With
- i = i + 2
- Do
- Cells(i, "C").Cells(1, Weekday(xDay, vbSunday)).Cells = Day(xDay)
- With Cells(i, "¢Ð")
- If .Cells = "" Then
- x = Application.WorksheetFunction.WeekNum(xDay)
- If x < UBound(½üȪí) Then
- .Cells = ½üȪí(x)
- Else
- If x Mod UBound(½üȪí) = 0 Then
- .Cells = ½üȪí(1)
- Else
- .Cells = ½üȪí(x Mod UBound(½üȪí) + 1)
- End If
- End If
- End If
- End With
- If Cells(i, "¢Ð") = "" Then Application.WorksheetFunction.WeekNum (xDay)
- If Weekday(xDay, vbSunday) = 7 And Month(xDay) = Month(xDay + 1) Then i = i + 1
- xDay = xDay + 1
- Loop Until Month(xDay) <> Month(xDay - 1)
- i = i + 1
- Loop Until Year(xDay) <> Year(xDay - 1)
- End Sub
½Æ»s¥N½X |
|