ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

²Ö­p¥[Á`¼Æ¶q¤Î¨C¶g¥[Á`¼Æ¶q

¦^´_ 6# yen956
  1. '3¤ë1¤éªº«e¤@¤Ñ, §Y¬°2¤ëªº³Ì«á¤@¤Ñ, ¤]¬O2¤ëªº¤Ñ¼Æ
  2.          '³o¤]¬O Excel §P§O¶§¾äy¦~¬O§_¬°¶|¦~ªº¥t¤@¤èªk
  3.         Mdays(2) = Day(DateSerial([N1], 3, 1) - 1)
½Æ»s¥N½X
³o¤]¬O3¤ë1¤éªº«e¤@¤Ñ
  1. Day(DateSerial([N1], 3, 0))
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 8# yen956
¤]¥i¥H¦p¦¹
  1. Private Sub EX()
  2.     Dim i As Integer, Rng  As Range, MoDay As Date
  3.     MoDay = DateSerial([n1], [q1], 1)
  4.     With Range("C2:C4")
  5.         .Resize(, 31) = ""
  6.         With .Offset(3).Resize(, 31)
  7.             .UnMerge
  8.             .Rows("2:3") = ""
  9.         End With
  10.         i = 1
  11.        Do While Month(MoDay + i - 1) = Month(MoDay)     '¦P¤@¤ë¥÷
  12.             .Cells(1, i) = MoDay + i - 1
  13.             .Cells(2, i) = i
  14.             .Cells(3, i) = Weekday(MoDay + (i - 1), 2)
  15.             .Cells(5, i) = Application.Evaluate("Sum(" & .Cells(4, 1).Resize(, i).Address & ")")
  16.             If .Cells(3, i) = 7 Or i = Day(DateAdd("M", 1, MoDay) - 1) Then '©Î¬O ¦¹¤ë¥÷³Ì«á¤@¤Ñ
  17.                 If i <= 7 Then                                  '²Ä¤@¶g
  18.                     Set Rng = .Cells(6, i).Offset(, -(i - 1)).Resize(, i)
  19.                 ElseIf .Cells(3, i) = 7 Then                    '¨C¶g
  20.                     Set Rng = .Cells(6, i).Offset(, -6).Resize(, 7)
  21.                 ElseIf i = Day(DateAdd("M", 1, MoDay) - 1) Then  '¤ë©³
  22.                     Set Rng = .Cells(6, i).Offset(, -(.Cells(3, i) - 1)).Resize(, .Cells(3, i))
  23.                 End If
  24.                 With Rng
  25.                     .Merge
  26.                     .Cells(1) = Application.Evaluate("Sum(" & .Offset(-2).Cells(1).Resize(, .Columns.Count).Address & ")")
  27.                     .HorizontalAlignment = xlCenter
  28.                     .VerticalAlignment = xlCenter
  29.                     .WrapText = True
  30.                 End With
  31.             End If
  32.             i = i + 1
  33.        Loop
  34.     End With
  35. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ºÉ¦h¤Ö¥»¥÷¡A´N±o¦h¤Ö¥»¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD