Board logo

¼ÐÃD: [µo°Ý] ½Ð°Ý ARRAY½d³ò §ï¦¨ °ÊºA «ü©w ½d³ò°ÝÃD ½Ð«e½ú­Ì«ü±Ð [¥´¦L¥»­¶]

§@ªÌ: °a¤ªºµ    ®É¶¡: 2020-6-15 13:42     ¼ÐÃD: ½Ð°Ý ARRAY½d³ò §ï¦¨ °ÊºA «ü©w ½d³ò°ÝÃD ½Ð«e½ú­Ì«ü±Ð

Private Sub CommandButton2_Click()
'3­Ó¤ë
If TextBox2.Value = 1 Then A = Array(3, 5, 7, 15, 17, 19)
If TextBox2.Value = 2 Then A = Array(5, 7, 9, 17, 19, 21)
If TextBox2.Value = 3 Then A = Array(7, 9, 11, 19, 21, 23)
If TextBox2.Value = 4 Then A = Array(9, 11, 13, 21, 23, 25)
If TextBox2.Value = 5 Then A = Array(11, 13, 15, 23, 25)
If TextBox2.Value = 6 Then A = Array(13, 15, 17, 25)
If TextBox2.Value = 7 Then A = Array(15, 17, 19)
If TextBox2.Value = 8 Then A = Array(17, 19, 21)
If TextBox2.Value = 9 Then A = Array(19, 21, 23)
If TextBox2.Value = 10 Then A = Array(21, 23, 25)
If TextBox2.Value = 11 Then A = Array(23, 25)
If TextBox2.Value = 12 Then A = Array(25)
If TextBox2.Value = "" Then A = Array(3, 5, 7, 15, 17, 19)

For I = LBound(A) To UBound(A)
    For J = 4 To Cells(3, 4).End(xlToRight).Column
        If Cells(A(I), J) = "¤é¯Z" Then Cells(A(I), J) = "©]¯Z"
        If Cells(A(I), J) <> "" And Cells(A(I), J) = "©]¯Z" Then
           Cells(A(I), J).Font.Color = RGB(Cells(1, 26), Cells(1, 27), Cells(1, 28))
           Cells(A(I), J).Interior.Color = RGB(Cells(1, 32), Cells(1, 33), Cells(1, 34))
        End If
    Next J
Next I
Erase A

UserForm3.Hide
TextBox2.Value = ""
End Sub

½Ð°Ý«e½ú­Ì ¥H¤U³o¬q¸Ó¦p¦ó§ï¼g ¤~¯à°÷§ï¦¨°ÊºAªº³W«ß ¦p¦ó¥i¥HÁY´îµ{¦¡½X
ÁÙ¦³¤@­Ó©µ¦ù°ÝÃD ·í©µ¦ù¨ì³Ì«á¤@­Ó¤ë®É¤£º¡3­Ó¤ë ¸Ó¦p¦ó©µ¦ù¦Ü¤U¤@¦~ªº²Ä¤@­Ó¤ë
½Ð«e½ú­Ì«ü±Ð µ{¦¡¯S§OÃlªø ¬Ý°_¨Ó¥i¯à·|¦³¨Ç¤£¤è«K ¤£¦n·N«ä ^^"

If TextBox2.Value = 1 Then A = Array(3, 5, 7, 15, 17, 19)
If TextBox2.Value = 2 Then A = Array(5, 7, 9, 17, 19, 21)
If TextBox2.Value = 3 Then A = Array(7, 9, 11, 19, 21, 23)
If TextBox2.Value = 4 Then A = Array(9, 11, 13, 21, 23, 25)
If TextBox2.Value = 5 Then A = Array(11, 13, 15, 23, 25)
If TextBox2.Value = 6 Then A = Array(13, 15, 17, 25)
If TextBox2.Value = 7 Then A = Array(15, 17, 19)
If TextBox2.Value = 8 Then A = Array(17, 19, 21)
If TextBox2.Value = 9 Then A = Array(19, 21, 23)
If TextBox2.Value = 10 Then A = Array(21, 23, 25)
If TextBox2.Value = 11 Then A = Array(23, 25)
If TextBox2.Value = 12 Then A = Array(25)
If TextBox2.Value = "" Then A = Array(3, 5, 7, 15, 17, 19)
[attach]32173[/attach]
§@ªÌ: °a¤ªºµ    ®É¶¡: 2020-6-15 14:05

´N¬O¤ë¥÷ªº³¡¤À  §ï¦¨¥i¥H¥Î¿é¤Jªí³æªº¤è¦¡ 2­Ó¤ë½ü¤@¦¸ ©ÎµÛ¬O 3­Ó¤ë½ü¤@¦¸
§@ªÌ: ­ã´£³¡ªL    ®É¶¡: 2020-6-16 11:52

¦^´_ 2# °a¤ªºµ

¦Û¤v¼gªº³W«h¦Û¤v¬Ý±oÀ´, ³o¤~¬O³Ì­«­nªº, ²¤Æ¤£¤@©w´N¦n!!!
¥u¤@±i¤u§@ªí´N¬Ý±o²´ªá, ¤£¤Ó·Q¥h¤F¸Ñ,
¤é´Á°µ¦¨¤å¦r, ¹ïEXCEL¨Ó»¡, ¤£¬O¦n²ßºD, ¹ï©¹«áªººûÅ@¤Î²Î­p¹Bºâ³£¦³»Ùê,
Åý¬Ý¨ìªº¬O"®æ¦¡", ¤º®e¬O¯u¹ê¼Æ­È, ¬O³Ì¦nªº~~
§@ªÌ: °a¤ªºµ    ®É¶¡: 2020-6-16 13:28

ÁÂÁ­㴣¤j¤j ©¹«á§Ú·|§ï±¼³o­ÓÃa²ßºDªº
§@ªÌ: n7822123    ®É¶¡: 2020-6-17 01:56

¥»©«³Ì«á¥Ñ n7822123 ©ó 2020-6-17 02:06 ½s¿è

¦^´_ 1# °a¤ªºµ

»Ý¨D¡G
½Ð°Ý«e½ú­Ì ¥H¤U³o¬q¸Ó¦p¦ó§ï¼g ¤~¯à°÷§ï¦¨°ÊºAªº³W«ß ¦p¦ó¥i¥HÁY´îµ{¦¡½X

If TextBox2.Value = 1 Then A = Array(3, 5, 7, 15, 17, 19)
If TextBox2.Value = 2 Then A = Array(5, 7, 9, 17, 19, 21)
If TextBox2.Value = 3 Then A = Array(7, 9, 11, 19, 21, 23)
If TextBox2.Value = 4 Then A = Array(9, 11, 13, 21, 23, 25)
If TextBox2.Value = 5 Then A = Array(11, 13, 15, 23, 25)
If TextBox2.Value = 6 Then A = Array(13, 15, 17, 25)
If TextBox2.Value = 7 Then A = Array(15, 17, 19)
If TextBox2.Value = 8 Then A = Array(17, 19, 21)
If TextBox2.Value = 9 Then A = Array(19, 21, 23)
If TextBox2.Value = 10 Then A = Array(21, 23, 25)
If TextBox2.Value = 11 Then A = Array(23, 25)
If TextBox2.Value = 12 Then A = Array(25)
If TextBox2.Value = "" Then A = Array(3, 5, 7, 15, 17, 19)

¦P·N·Ç¤j»¡ªº¡A¦Û¤v¼gªºµ{¦¡¦Û¤v¯à¬ÝÀ´¡A¤~¬O³Ì¦nªº¡I
§O¤H¼gªº«Üµu«Ü¼F®`¡A§A¦pªG¬Ý¤£À´¡A¤§«á­n§ïµ{¦¡¤]µL±q¤U¤â¡A·|§óµh­W
¨Ì§Aªº»Ý¨D¡Aµ{¦¡§ï¦¨¦p¤U¡A¦ý°õ¦æ³t«×¤£·|¤ñ¸û§Ö~


k = TextBox2.Value: If k = "" Then k = 1
For i = k To 12: Idx = Idx + 1
  If Idx < 4 Or Idx > 6 Then
    itm = itm + 1: If itm = 7 Then Exit For
    s = s & "," & i * 2 + 1
  End If
Next i
A = Split(Mid(s, 2), ",")

§@ªÌ: n7822123    ®É¶¡: 2020-6-17 02:16

¥»©«³Ì«á¥Ñ n7822123 ©ó 2020-6-17 02:30 ½s¿è

¦^´_ 1# °a¤ªºµ


¼gªk¤G¡G
k = TextBox2.Value: If k = "" Then k = 1
For i = k To 12
  s = s & "," & i * 2 + 1
  itm = itm + 1: If itm = 6 Then Exit For
  If i = k + 2 Then i = i + 5
Next i
A = Split(Mid(s, 2), ",")


¬Ý§Aı±o¨º­Ó§A¤ñ¸û¦n²z¸Ñ
·s¤â¤£«Øij¦bFor°j°é¸Ì­±§ïFor°j°éªºÅܼƭÈ
¥H§K¤£¤p¤ß´N§Ë¦¨µL½a°j°é¡A©Ò¥H¤£¤Ó±ÀÂ˦¹¼gªk

§@ªÌ: n7822123    ®É¶¡: 2020-6-17 02:33

¥»©«³Ì«á¥Ñ n7822123 ©ó 2020-6-17 02:43 ½s¿è

¦^´_ 6# n7822123


º|§ï¨ì¡A­×¥¿¼gªk¤G

k = TextBox2.Value: If k = "" Then k = 1
For i = k To 12
  s = s & "," & i * 2 + 1
  itm = itm + 1: If itm = 6 Then Exit For
  If i = k + 2 Then i = i + 3    '¸õ¹L«á3­Ó°j°é
Next i
A = Split(Mid(s, 2), ",")

§@ªÌ: °a¤ªºµ    ®É¶¡: 2020-6-17 12:38

ÁÂÁ n7822123 ¤j¤j  µ{¦¡¤Ö«Ü¦h¦æ¤F
·í©µ¦ù¨ì³Ì«á¤@­Ó¤ë®É¤£º¡3­Ó¤ë ¸Ó¦p¦ó©µ¦ù¦Ü¤U¤@¦~ªº²Ä¤@­Ó¤ë©O?
§@ªÌ: ­ã´£³¡ªL    ®É¶¡: 2020-6-17 19:03

¥»©«³Ì«á¥Ñ ­ã´£³¡ªL ©ó 2020-6-17 19:05 ½s¿è

¦^´_ 8# °a¤ªºµ


1) ¤é¾ä¥u¦³¤@¦~¥÷, «ç©µ¦ù¤U¦~«×???
2) ¬°¦ó­n§Ë³o»ò¦hform???
3) ¶ñ©³¦â¦Ó¤v, ¦ó¥H­n¥Îvgaªí³æ¥h½Õ, ¤£Ä±¤Ó½ÆÂø???
4) ¨C­Ó¤ë¥Î31Äæ, ­n«ç¦C¦L¦¨¤@±i?
§@ªÌ: °a¤ªºµ    ®É¶¡: 2020-6-17 19:11

¦^­ã´£¤j¤j¨º­Ó§Ú¥u¬O·Q­n½m²ß¥Îªº¦]¬°§ÚÁÙ¬O·s¤â>"<    R1C4 ªº 2020 §ï¦¨2021 ¥i¥H©µ¦ùÅã¥Ü¤U¤@¦~¥÷
¯Z§O ½ü¯Z ªº³¡¤À ¬O¥i¥H©µ¦ù ¦ý¬O¨C­Ó¤ë¤Ñ¼Æ¤£¦P ­n°µ¨ì 2~3­Ó¤ëªº©µ¦ù´N¥d¦í¤F ^^"
§@ªÌ: n7822123    ®É¶¡: 2020-6-23 14:09

¥»©«³Ì«á¥Ñ n7822123 ©ó 2020-6-23 14:13 ½s¿è

¦^´_ 10# °a¤ªºµ

Å¥·Ç¤jªº~~§A´NÅý¤é´Á¦^Âk¨ì¤é´Á®æ¦¡¡A§O¥Î¤å¦r®æ¦¡ª±

¤é´Á®æ¦¡¬O¥i¥H°µ­pºâªº¡A¥Î¤é´Á®æ¦¡­pºâ¡Aºâ¨ì¦è¤¸3000¦~~³£¨S°ÝÃD

­nµo°Ý´N­n§â§Aªº°ÝÃD ´£¨ú¥X¨Ó¡A°µ¦¨Â²³æªºExcelÀɮסA¥i¥H°µ´ú¸Õ´N¦n

¤j³¡¤À¤H(¥]§t§Ú)¬Ý¨ì¤@¤j¦êµ{¦¡¡A´NÃiªº¥h¬ã¨s¤F¡A¦óªp¤j³¡¤Àµ{¦¡¸ò§A´£°Ýªº¤£¬Û¤z

©Ò¥H§Ú¥»¨Ó¬OÃi±o¦^§Aªº~

§Ú°µ¤@­Ó¤p½d¨ÒÅý§A°Ñ¦Ò§a¡A§Aªºµ{¦¡¤£¬Û¤zªºªF¦è¦³ÂI¦h¡AÃiªº¬ã¨s

Sub ª±¤é´Á()
Dim Date1 As Date, Date2 As Date
CheckOK = False
Do Until CheckOK
  On Error Resume Next
  Date1 = InputBox("½Ð¿é¤J²Ä¤@¤Ñ¤W¯Z¤é´Á¡A" & vbCrLf & " »Ý­n¤é´Á®æ¦¡ Ex¡G2020/1/1")
  If Err <> 0 Then MsgBox "§A¿é¤Jªº¤£¬O¤é´Á®æ¦¡¡A½Ð­×§ï" Else CheckOK = True
  On Error GoTo 0
Loop
CheckOK = False
Do Until CheckOK
  On Error Resume Next
  Date2 = InputBox("½Ð¿é¤J­n¬d¸ßªº¤é´Á¡A" & vbCrLf & " »Ý­n¤é´Á®æ¦¡ Ex¡G2020/7/1")
  If Err <> 0 Then MsgBox "§A¿é¤Jªº¤£¬O¤é´Á®æ¦¡¡A½Ð­×§ï" Else CheckOK = True
  On Error GoTo 0
Loop
Date1 = Date1 - 1
If Date2 - Date1 < 0 Then MsgBox "§A¿é¤Jªº¬d¸ß¤é´Á¤ñ²Ä¤@¤Ñ¤W¯Z¤éÁÙ«e­±": Exit Sub
'¥H°µ4¥ð2¬°¨Ò(6¤Ñ¤@´`Àô)
Select Case (Date2 - Date1) Mod 6
    Case 1, 2, 3, 4: MsgBox "³o¤Ñ­n¤W¯Z"
    Case 5, 6: MsgBox "®¥³ß!³o¤Ñ¬O¥ð°²^.^"
End Select
End Sub

§@ªÌ: °a¤ªºµ    ®É¶¡: 2020-6-23 17:37

ÁÂÁ n7822123 ¤j¤jªº«ü±Ð  §Ú·|¦n¦n¬ã¨s¾Ç²ß ÁÂÁ±z
­ì¥»·|³o¼Ë¼g¬O¦]¬° ¸ûª½Ä± ¦n²z¸Ñ ¦ý·|³y¦¨­pºâ©M®æ¦¡°ÝÃD
§Ú·|Å¥·Ç¤j¤jªº §ï±¼³o­ÓÃa²ßºDªº   
ªº½T¤é´ÁÂà¤å¦r·|³y¦¨«Ü¦h¤£¥²­nªº°ÝÃD  ¤]·|¦]¬°Âà¤å¦r ¦h¼g¤F«Ü¦h¦æ ¤p§Ì¨ü±Ð¤F
§@ªÌ: n7822123    ®É¶¡: 2020-6-24 00:13

¦^´_ 12# °a¤ªºµ

Å¥§Aªº¦^ÂСA·Pı§A¥i¥H¦Û¤v§¹¦¨¹Æ~

¥t¥~§Úªº½d¨Òµ{¦¡¦³ÂI¤p¿ù


Sub ª±¤é´Á()
Dim Date1 As Date, Date2 As Date
CheckOK = False
Do Until CheckOK
  On Error Resume Next
  Date1 = InputBox("½Ð¿é¤J²Ä¤@¤Ñ¤W¯Z¤é´Á¡A" & vbCrLf & " »Ý­n¤é´Á®æ¦¡ Ex¡G2020/1/1")
  If Err <> 0 Then MsgBox "§A¿é¤Jªº¤£¬O¤é´Á®æ¦¡¡A½Ð­×§ï" Else CheckOK = True
  On Error GoTo 0
Loop
CheckOK = False
Do Until CheckOK
  On Error Resume Next
  Date2 = InputBox("½Ð¿é¤J­n¬d¸ßªº¤é´Á¡A" & vbCrLf & " »Ý­n¤é´Á®æ¦¡ Ex¡G2020/7/1")
  If Err <> 0 Then MsgBox "§A¿é¤Jªº¤£¬O¤é´Á®æ¦¡¡A½Ð­×§ï" Else CheckOK = True
  On Error GoTo 0
Loop
Date1 = Date1 - 1
If Date2 - Date1 < 0 Then MsgBox "§A¿é¤Jªº¬d¸ß¤é´Á¤ñ²Ä¤@¤Ñ¤W¯Z¤éÁÙ«e­±": Exit Sub
'¥H°µ4¥ð2¬°¨Ò(6¤Ñ¤@´`Àô)
Select Case Int(Date2 - Date1) Mod 6
    Case 1, 2, 3, 4: MsgBox "³o¤Ñ­n¤W¯Z"
    Case 5, 0: MsgBox "®¥³ß!³o¤Ñ¬O¥ð°²^.^"
End Select
End Sub  

§@ªÌ: °a¤ªºµ    ®É¶¡: 2020-6-24 06:05

¥»©«³Ì«á¥Ñ °a¤ªºµ ©ó 2020-6-24 06:08 ½s¿è

n7822123¤j¤j §ÚÁÙ¬O¨S¿ìªk ¤£ª¾¹D¬°¬Æ»ò  ¤W±µ¤£¨ì¤U ¦³®É­Ô·|¶]¥¢±Ñ ¦pªG¥[©µ¿ð ¤SÅܱo«ÜºC
¤£¹L©µ¦ù¤U¤@¦~°ÝÃD ¸Ñ¨M¤F ¤w¸g¤£»Ý­n¥ý¦s¨ìÀx¦s®æ ³o¤èªk¬O¥i¥H¦Û°Ê©µ¦ù  ÁÂÁÂn7822123¤j¤j
Sub ¤é´Á½m²ß()
'Application.ScreenUpdating = False

Range(Cells(2, 1).End(xlToRight), Cells(2, 1).End(xlDown)).Clear

    S = 3
    E = 1
    For F = 1 To 12 '«Ø¥ß½d³ò
        For P = 1 To Day(DateSerial(Year(Now), F + 1, 0))
            Cells(S, E) = DateSerial(Year(Now), F, P)
            Cells(S - 1, E) = F & "¤ë" & P & "¤é" & WeekdayName(Weekday(P))
            E = E + 1
            If P = Day(DateSerial(Year(Now), F + 1, 0)) Then
            If F = 12 Then Exit For
               S = S + 2
               E = 1
            End If
        Next P
    Next F
   
    For E = ActiveWorkbook.Names.Count To 1 Step -1 '²M°£©w¸q¦WºÙ
       If ActiveWorkbook.Names(E).Name <> "«ü©w½d³ò" Then
          ActiveWorkbook.Names(E).Delete
       End If
    Next E
   
    Y = 65
    For i = 3 To Cells(3, 1).End(xlDown).Row Step 2 '©w¸q¦WºÙ
        ½d³ò¦WºÙ = Chr(Y)
        Names.Add Name:="²Ä" & ½d³ò¦WºÙ & "¶µ", RefersTo:=Range(Cells(i, 1), Cells(i, 1).End(xlToRight))
        Y = Y + 1
    Next i
    'Application.Wait Now + TimeValue("00:00:01")
   
    Set AWN = ActiveWorkbook.Names '¦X¨Ö
    For R = 1 To AWN.Count
       If R <> 1 Then
          K = Mid(AWN(R).RefersToR1C1Local, 2, Len(AWN(R))) & ","
       Else
          K = AWN(R).RefersToR1C1Local & ","
       End If
        u = u + K
    Next R
   
    Names.Add Name:="«ü©w½d³ò", RefersTo:=Mid(u, 1, Len(u) - 1)
   
    For E = ActiveWorkbook.Names.Count To 1 Step -1 '²M°£©w¸q¦WºÙ
       If ActiveWorkbook.Names(E).Name <> "«ü©w½d³ò" Then
          ActiveWorkbook.Names(E).Delete
       End If
    Next E

    For Each G In Range("«ü©w½d³ò")
        D = G.Offset
        Select Case DateAdd("d", -1, D) Mod 6 + 1
        Case 1 To 4
            G.Offset = "¤W¯Z"
            G.Offset.Font.Color = RGB(0, 0, 89)
            G.Interior.Color = RGB(150, 201, 123)
        Case 5 To 6
            G.Offset = "¥ð°²"
            G.Offset.Font.Color = RGB(114, 0, 55)
            G.Offset.Interior.Color = RGB(255, 255, 92)
        End Select
    Next G
   
'Application.ScreenUpdating = True
End Sub
§@ªÌ: °a¤ªºµ    ®É¶¡: 2020-6-24 06:52

¦pªG§â  G.Offset = "¤W¯Z" ©M G.Offset = "¥ð°²" Ãö±¼ ´N¤£·|¥X¿ù¤F ¦ý¬O ³o¼Ë´N¹F¤£¨ì¥Øªº¤F
¤£ª¾¹D¦³¨S¦³§Oªº¤è¦¡  
Select Case DateAdd("d", -1, D) Mod 6 + 1 ³o¬q¦³°ÝÃD  µ{¦¡¤w¸g¶]§¹¤F ¦ý¬OÁÙ¬O·|°±¦b³o¸Ì
»¡«¬ºA¤£²Å ¦ý§Úµ{¦¡¤w¸g¶]§¹¤F ¤£ª¾¹D¬°¬Æ»ò...
    For Each G In Range("«ü©w½d³ò")
        D = G.Offset
        Select Case DateAdd("d", -1, D) Mod 6 + 1
        Case 1 To 4
'            G.Offset = "¤W¯Z"
            G.Offset.Font.Color = RGB(0, 0, 89)
            G.Interior.Color = RGB(150, 201, 123)
        Case 5 To 6
'            G.Offset = "¥ð°²"
            G.Offset.Font.Color = RGB(114, 0, 55)
            G.Offset.Interior.Color = RGB(255, 255, 92)
        End Select
    Next G
§@ªÌ: °a¤ªºµ    ®É¶¡: 2020-6-24 07:20

­è¤~¦b³Ì«á ¦h¥[¤@­Ó°j°é §â¤å¦r¸òÃC¦â¤À¶} ´N¥i¥H¤F ¤S¬O®æ¦¡°ÝÃD
·PÁ    ·Ç¤j¤j ©M  n7822123 ¤j¤jªº«ü¾É
    For Each H In Range("«ü©w½d³ò")
        If H.Interior.Color = RGB(150, 201, 123) Then H.Offset = "¤W¯Z"
        If H.Offset.Interior.Color = RGB(255, 255, 92) Then H.Offset = "¥ð°²"
    Next H
§@ªÌ: °a¤ªºµ    ®É¶¡: 2020-6-24 15:21

¤l²Ó¬Ý¤F n7822123 ¤j¤jªº Sub ª±¤é´Á ()   µo²{
§â¥~­±¦A¥]¤@­Ó Int     D = Int(G.Offset)    ´N¥¿±`¤F¤£¥Î¦h¥[°j°é  >"<
§@ªÌ: ­ã´£³¡ªL    ®É¶¡: 2020-6-28 11:24

¤½¦¡+VBA:
[attach]32235[/attach]

¨º"±Æ¯Z"--¶È¥H [¤W?¥ð?] ¨Ó±Æ, ¤£¨ã¹ê¥Î©Ê, °Ñ¦Ò§a!
[attach]32236[/attach]
§@ªÌ: °a¤ªºµ    ®É¶¡: 2020-6-28 19:36

½Ð°Ý­ã´£¤j¤j¡@¦pªG­n³]©w´X½ü¤W¡@©]¯Z¡@¤é¯Z¡@°²³]¤@½ü¬O¢°¢±¤Ñ
¸Ó¦p¦ó¼g©O¡H
·Ç´£¤j¤jªºª©¥»¡@±Æª©§ó¬O²M·¡¡@¦ý§ÚÀ³¸Ó¦b­þ¤@¬q­×§ï¡@­n«ç»ò¼g¡H¡@

¥H¤U¬O¤§«e­×§ï¹Lªº¡@¦ý¹ï§Ú¨Ó»¡¤w¸g¬O·¥­­¤F¡D¡D¹ê¦b·Q¤£¥X¨Ó¡@¡ÖÈСÕ
°ÝÃD¥X¦b³o¸Ì¡G
¦pªG¥Î¡@ÈУ@£@ÈС@¶g¼Æ­pºâ¤W¯Zªº¤Ñ¼Æ´N·|¦³°ÝÃD¡D¡D¤£ª¾¦p¦ó­×§ï¡@
ÈТìÈФѼƷ|·f¤£¨ì¡@¡@
        Select Case DateAdd("d", -1, K) Mod Cells(1, 3) + 1   '±`¤é¯Z
        Case 1 To Cells(1, 4)
            G.Offset = "¤W¯Z"
            G.Offset.Font.Color = RGB(0, 0, 89)
            G.Interior.Color = RGB(150, 201, 123)
        Case Cells(1, 4) + 1 To Cells(1, 4) + Cells(1, 5)
            If G.Offset >= Cells(1, 1) Then
            G.Offset = "¥ð°²"
            G.Offset.Font.Color = RGB(114, 0, 55)
            G.Offset.Interior.Color = RGB(255, 255, 92)
            End If
        End Select
        
        Select Case DateAdd("d", -1, K) Mod Cells(1, 7) + 1 '©P½ü¯Z
        Case 1 To Cells(1, 4)
            G.Offset = "©]¯Z"
            G.Offset.Font.Color = RGB(114, 0, 55)
            G.Offset.Interior.Color = RGB(255, 208, 0)
        Case Cells(1, 4) + 1 To Cells(1, 4) + Cells(1, 5)
        End Select
¡@¡Ð¡Ð¡Ð¡Ð¡Ð¡Ð¡Ð¡Ð¡Ð¡Ð¡Ð¡Ð¡Ð¡Ð¡Ð¡Ð¡Ð¡Ð¡Ð¡Ð¡Ð¡Ð
  1. Public Sub ©P½ü¯Z½m²ß()
  2. Range(Cells(2, 1).End(xlToRight), Cells(2, 1).End(xlDown)).Clear
  3. Cells(1, 3) = Cells(1, 4) + Cells(1, 5)
  4. Cells(1, 7) = Cells(1, 3) * 2
  5.    If Cells(1, 2) = "" Then
  6.       Cells(1, 2) = Year(Date)
  7.    Else
  8.       Cells(1, 2) = Cells(1, 2)
  9.    End If

  10.     S = 3
  11.     E = 1
  12.     For F = 1 To 12 '«Ø¥ß½d³ò
  13.         For P = 1 To Day(DateSerial(Cells(1, 2), F + 1, 0))
  14.             Cells(S, E) = DateSerial(Cells(1, 2), F, P)
  15.             Cells(S - 1, E) = F & "¤ë" & P & "¤é" & WeekdayName(Weekday(P))
  16.             E = E + 1
  17.             If P = Day(DateSerial(Cells(1, 2), F + 1, 0)) Then
  18.             If F = 12 Then Exit For
  19.                S = S + 2
  20.                E = 1
  21.             End If
  22.         Next P
  23.     Next F
  24.    
  25.     For E = ActiveWorkbook.Names.Count To 1 Step -1 '²M°£©w¸q¦WºÙ
  26.        If ActiveWorkbook.Names(E).Name <> "" Then
  27.           ActiveWorkbook.Names(E).Delete
  28.        End If
  29.     Next E
  30.    
  31.     Y = 65
  32.     For i = 3 To Cells(3, 1).End(xlDown).Row Step 2 '©w¸q¦WºÙ
  33.         ½d³ò¦WºÙ = Chr(Y)
  34.         Names.Add Name:="²Ä" & ½d³ò¦WºÙ & "¶µ", RefersTo:=Range(Cells(i, 1), Cells(i, 1).End(xlToRight))
  35.         Y = Y + 1
  36.     Next i
  37.    
  38.     Set AWN = ActiveWorkbook.Names '¦X¨Ö
  39.     For R = 1 To AWN.Count
  40.        If R <> 1 Then
  41.           K = Mid(AWN(R).RefersToR1C1Local, 2, Len(AWN(R))) & ","
  42.        Else
  43.           K = AWN(R).RefersToR1C1Local & ","
  44.        End If
  45.         U = U + K
  46.     Next R
  47.     Names.Add Name:="«ü©w½d³ò", RefersTo:=Mid(U, 1, Len(U) - 1)
  48.    
  49.     For E = ActiveWorkbook.Names.Count To 1 Step -1 '²M°£©w¸q¦WºÙ
  50.        If ActiveWorkbook.Names(E).Name <> "«ü©w½d³ò" Then
  51.           ActiveWorkbook.Names(E).Delete
  52.        End If
  53.     Next E
  54.    
  55.    If Cells(1, 1) = "" Then
  56.       Cells(1, 1) = Cells(3, 1)
  57.    Else
  58.       Cells(1, 1) = Cells(1, 1)
  59.    End If
  60.    
  61.     D = Cells(1, 1)
  62.    
  63.     For Each G In Range("«ü©w½d³ò") '©P½ü¯Z
  64.     If G.Offset >= Cells(1, 1) Then
  65.         If Weekday(G) = 1 Or Weekday(G) = 7 Then '¤»¤é¤W¦â
  66.            G.Offset(-1, 0).Interior.Color = RGB(172, 199, 213)
  67.         End If
  68.    
  69.         K = G.Offset
  70.         
  71.         Select Case DateAdd("d", -1, K) Mod 6 + 1   '±`¤é¯Z
  72.         Case 1 To 4
  73.             G.Offset = "¤W¯Z"
  74.             G.Offset.Font.Color = RGB(0, 0, 89)
  75.             G.Interior.Color = RGB(150, 201, 123)
  76.         Case 5 To 6
  77.             If G.Offset >= Cells(1, 1) Then
  78.             G.Offset = "¥ð°²"
  79.             G.Offset.Font.Color = RGB(114, 0, 55)
  80.             G.Offset.Interior.Color = RGB(255, 255, 92)
  81.             End If
  82.         End Select
  83.         
  84.         Select Case DateAdd("d", -1, K) Mod 12 + 1 '©P½ü¯Z
  85.         Case 1 To 4
  86.             G.Offset = "©]¯Z"
  87.             G.Offset.Font.Color = RGB(114, 0, 55)
  88.             G.Offset.Interior.Color = RGB(255, 208, 0)
  89.         Case 5 To 6
  90.         End Select
  91.         
  92.     End If
  93.     Next G
  94.    
  95. End Sub
½Æ»s¥N½X

§@ªÌ: °a¤ªºµ    ®É¶¡: 2020-6-29 02:28

¥»©«³Ì«á¥Ñ °a¤ªºµ ©ó 2020-6-29 02:29 ½s¿è

°ÝÃD¸Ñ¨M¤F >"< ¦ý¬O³o¼gªk ¨Ã¤£¬O«Ü¦n  
«á¨Ó·Q¥X¨Óªº¿ìªk¬O¥Î ÃC¦â ¥h°µ§PÂ_
¤é´Áªº­pºâ ¹ê¦b¨S¿ìªk...¯uªº·Q¤£¥X¨Ó
¦A§â³Ì«áªºÃC¦â¼Æ­È¥ý¦s¨ìÀx¦s®æ
§ó§ï¤U¤@¦~¤§«á ¦A§âÃC¦â¼Æ­È¦s¦^ÅܼÆ...
¹ê¦b·Q¤£¥X¿ìªkªº¿ìªk...  §Æ±æ¦³§ó¦nªº¿ìªk
·Ç´£¤j¤jªºª©¥» ±Æª©§ó¬O²M·¡¡@
¦ý§ÚÀ³¸Ó¦b­þ¤@¬q­×§ï¡@­n«ç»ò¼g¡H
§@ªÌ: n7822123    ®É¶¡: 2020-6-30 00:37

¥»©«³Ì«á¥Ñ n7822123 ©ó 2020-6-30 00:49 ½s¿è

¦^´_ 20# °a¤ªºµ


·Ç´£¤j¤jªºª©¥» ±Æª©§ó¬O²M·¡

·Ç¤jªºª©¥»¬Ý°_¨Ó«ÜµÎªA¡A

§A¤w¸g­n©ñ±ó§A­ì¥»«Üªáªº®æ¦¡¡A·Q¥Î·Ç¤jªºª©¥»¤F¶ÜXD  ¡@


»Ý¨D¡G

¦pªG­n³]©w´X½ü¤W¡@©]¯Z¡@¤é¯Z
¦ý§ÚÀ³¸Ó¦b­þ¤@¬q­×§ï¡@­n«ç»ò¼g¡H

·Ç¤j¤£¬O¥Î¯ÂVBA°µªº¡A¦³·f°t©w¸q¦WºÙ¡B¨ç¼Æ¤½¦¡

²³æ¨Ó»¡¡A¤£¯à¥uµ¹§AVBAµ{¦¡~

¥ý¶}Äæ¦ì§a~~¦p¤U¹Ï


[attach]32238[/attach]


Àx¦s®æC8 ·s¼W¤@­Ó¿ï¶µ "¤é©]½ü¬y"

°²³]¤@¼Ë°µ4¥ð2¡A6¤Ñ¬°1½ü¡A²Ä1~4½ü¤W¤é¯Z¡A²Ä6~10½ü¤W©]¯Z¡A²Ä11½ü¤S¦^¨ì¤é¯Z¡A¥H¦¹Ãþ±À~

§A­nªº¥\¯à¡A¥u»Ý­n­×§ï "Sub ¤é¾ä_±Æ¯Z" ³o­Óµ{§Ç§Y¥i

¦Ó¥B¸ê®Æªº³¡¤À§ó¬O¥u»Ý­×§ïAD¡BAE ¨âÄæ¡A¦¹µ{§Çªº«á¬qµ{¦¡»P¸ê®ÆµLÃö¡A¤º®e¤j·§¬O

¥ÎVBA³]¤½¦¡(§ìAD¡BAE¸ê®Æ)>½Æ»s¤½¦¡>²M°£¤½¦¡>³]Àx¦s®æÃC¦â(¨Ì[aRngColor]®æ¦¡)

¤]´N¥u¬O§â¤ë¾ä®æ¦¡§Ë¥X¨Ó¦Ó¤w¡A§A¦³¿³½ì¤]¥i¥H¬ã¨s¤@¤U

·Ç¤j¼gªºµ{¦¡À³¸Ó¥i¥HÅý§A¾Ç¨ì«Ü¦h~~~«e´£¬O§A­n¯à¬Ý±oÀ´~

®Ú¾Ú§Aªº»Ý¨D¡A§Ú§â§Ú·s¼Wªºµ{¦¡¥Î¬õ¦â Hight Light

³o¼Ë§A¥i¥H¤ñ¸û¦n°Ï¤À§ï¤F­þ¨Ç¡A¬°¤°»ò³o¼Ë§ï~

§Úªºµ{¦¡¬O°²³] ¥ý½ü¤é¯Z ¦A½ü©]¯Z¡A¦pªG§A­nÄA­Ë¡A¥i¥H¸ÕµÛ§ï¬Ý¬Ý~¯uªº¤£Ãø


Sub ¤é¾ä_±Æ¯Z()
Dim D1&, D2&, xDay&, xMon&, xTP$, xVM&, xVD1%, xVD2%
Dim Arr, i&, R&, C&, C2&, N&, TN&, T$, xR As Range
If [A_Head] = [A_End] Then MsgBox "**¡e¤ë¾ä¡f©|¥¼«Ø¥ß!   ":  Exit Sub
D1 = [A_Head]: D2 = [A_End] + 30
'---------------------------------
xDay = [aRng1]: If xDay = 0 Then xDay = D1
If xDay < D1 Or xDay > D2 Then MsgBox "¡e±Æ¯Z­º¤é¡f¶W¥X¤é¾ä½d³ò!   ":  Exit Sub
xMon = Format(xDay, "yyyymm")
'---------------------------------
xTP = [aRng2]: If xTP = "" Then MsgBox "¡e±Æ¯Z¯Z§O¡f¥¼¿é¤J!   ": Exit Sub
If xTP = "¤é©]½ü¬y" Then Turn = True
xVM = [aRng3]: If xVM = 0 Then MsgBox "¡e±Æ¯Z¤ë¼Æ¡f¥¼¿é¤J!   ": Exit Sub
xVD1 = [aRng4]: If xVD1 = 0 Then MsgBox "¡e±Æ¯Z¤Ñ¼Æ¡f¥¼¿é¤J!   ": Exit Sub
xVD2 = [aRng5]: If xVD2 = 0 Then MsgBox "¡e¥ð®§¤Ñ¼Æ¡f¥¼¿é¤J!   ": Exit Sub
Dturn = [aRng6]: NTurn = [aRng7]
If Turn And (Dturn = "" Or NTurn = "") Then MsgBox "¡e¤é¡B©]¯Z½ü¼Æ¡f¥¼¿é¤J§¹¥þ"  : Exit Sub

'---------------------------------
Call ¤é¾ä_±Æ¯Z_­«¸m
ReDim Arr(1 To D2 - xDay + 1, 1 To 2)
For i = xDay To D2
    xMon = Format(i, "yyyymm")
    If xMon <> YM Then YM = xMon: N = N + 1
    TN = Int((i - D1 + 1) / (xVD1 + xVD2))
    If N > xVM Then Exit For
    R = R + 1
    C = C Mod (xVD1 + xVD2) + 1
    C2 = TN Mod (Dturn + NTurn) + 1
    T = IIf(Turn, IIf(C2 > Dturn, "©]¯Z", "¤é¯Z"), xTP)

    If C > xVD1 Then T = "¥ð®§"
    Arr(R, 1) = i
    Arr(R, 2) = T
Next i
[AD1] = "¡Õ¤é´Á¡Ö": [AE1] = "¡Õ¯Z§O¡Ö"
[AD2:AE2].Resize(R) = Arr
...
...
...


[attach]32240[/attach]
§@ªÌ: n7822123    ®É¶¡: 2020-6-30 02:23

¦^´_ 21# n7822123


«u! ¬Ý¿ù¤F¡A³o¦æ§ï¤@¤U

TN = Int((i - xDay + 1) / (xVD1 + xVD2))
§@ªÌ: °a¤ªºµ    ®É¶¡: 2020-7-1 05:06

ÁÂÁÂn7822123¤j¤jªº«üÂI Åý§Ú·Q¨ì §â -1 ªº¦ì¸m§ï¤@¤U´N¥i¥H¤F
DateAdd("d", -1, K) Mod 12 + 1
¦Ñ¹ê»¡§Ú¯uªº¬Ý¤£À´  ¥u¯àF8 ºCºC¬ã¨sXD
·Ç¤jªºª©¥»¹ï§Ú¨Ó»¡¦n½ÆÂø ...¦pªG¦³¤£À´ªº¦a¤è ¦A½Ð±Ðn7822123¤j¤jÁÙ¦³¦U¦ì«e½ú­Ì ^^"
§@ªÌ: °a¤ªºµ    ®É¶¡: 2020-7-11 20:01

¥»©«³Ì«á¥Ñ °a¤ªºµ ©ó 2020-7-11 20:05 ½s¿è

½Ð°Ý ¦³Ãö©ó¤ë½ü¯Z  ¸ó¤ëªº³¡¤À°ÝÃD
·í¤@­Ó¤ë ªº³Ì«á¤@½ü ¨ì ¤U­Ó¤ëªº²Ä¤@½ü
¸Ó¥Î«ç»ò¼Ëªº§PÂ_¤è¦¡ ¤~¥i¥H§¹¾ãªº §â¤@¾ã½üªº¤Ñ¼Æ½ü§¹
¦Ó¤£·|¦]¬°¹j¤ëªº°ÝÃD ¾É­P ¿ù»~
¹Á¸Õ¤F­p¼Æªº¤è¦¡ ÁÙ¬O¤£¦æ ·|¥d¨ì¤ë¥÷°ÝÃD ¦³ªº¤ë¥÷¤Ñ¼Æ¤£¤@¼Ë
½Ð«e½ú­Ì À°À°¦£
[attach]32273[/attach]
[attach]32274[/attach]
§@ªÌ: °a¤ªºµ    ®É¶¡: 2020-7-12 21:00

°ÝÃD¸Ñ¨M¤F  ÁÂÁ·Ǵ£¤j¤jªºÀÉ®× ÁÙ¦³  n7822123¤j¤jªº ´£ÂI
«á¨Ó·Q¨ìªº¤è¦¡  ¬O§Q¥Î  False ¸ò True  ªº Boolean ÅܼƠ µM«á¦A§â ½ü¯ZªºÃC¦â¦¸¼Æ¥ý¦s¨ì Àx¦s®æ
¦A©µ¥Î ´N¥i¥H¤F XD
  1.                 If Y <= Cells(6, 11) Then
  2.                
  3.                     Select Case DateDiff("d", DateValue(d & "/1/1"), Cells(K, 1)) Mod Cells(5, 11) + 1
  4.                     Case 1 To Cells(3, 11)
  5.                     
  6.                     If Cells(1, 10) <> Year(Date) Then sss = True
  7.                     
  8.                     If yyy <> 0 And yyy <> Cells(3, 11) And sss = True Then
  9.                     
  10.                         Cells(U + 1, W) = "©]¯Z"
  11.                         Cells(U + 1, W).Font.Color = RGB(114, 0, 55)
  12.                         Cells(U + 1, W).Interior.Color = RGB(255, 208, 0)
  13.                         
  14.                         If Cells(U + 1, W) <> "¥ð°²" And Cells(U + 1, W) <> "¤W¯Z" Then yyy = yyy + 1
  15.                         Cells(1, 13) = yyy 'Àx¦s©µ¦ù¤Ñ¼Æ
  16.                         
  17.                         If yyy = Cells(3, 11) Then
  18.                            yyy = 0
  19.                            sss = False
  20.                         End If
  21.                         
  22.                     Else
  23.                         Cells(U + 1, W) = "¤W¯Z"
  24.                         Cells(U + 1, W).Font.Color = RGB(0, 0, 89)
  25.                         Cells(U + 1, W).Interior.Color = RGB(150, 201, 123)
  26.                     End If
  27.                     
  28.                         If Cells(U + 1, W) <> "¥ð°²" And Cells(U + 1, W) <> "©]¯Z" Then kkk = kkk + 1
  29.                         Cells(1, 12) = kkk 'Àx¦s©µ¦ù¤Ñ¼Æ
  30.                         If kkk = Cells(3, 11) Then kkk = 0
  31.                         
  32.                     End Select
  33.                     
  34.                 ElseIf Y <= Cells(6, 11) * 2 Then
  35.                
  36.                     Select Case DateDiff("d", DateValue(d & "/1/1"), Cells(K, 1)) Mod Cells(5, 11) + 1
  37.                     Case 1 To Cells(3, 11)
  38.                     
  39.                     If Cells(1, 10) <> Year(Date) Then sss = True
  40.                     
  41.                     If kkk <> 0 And kkk <> Cells(3, 11) And sss = True Then
  42.                         
  43.                         Cells(U + 1, W) = "¤W¯Z"
  44.                         Cells(U + 1, W).Font.Color = RGB(0, 0, 89)
  45.                         Cells(U + 1, W).Interior.Color = RGB(150, 201, 123)
  46.                         
  47.                         If Cells(U + 1, W) <> "¥ð°²" And Cells(U + 1, W) <> "©]¯Z" Then kkk = kkk + 1
  48.                         Cells(1, 12) = kkk 'Àx¦s©µ¦ù¤Ñ¼Æ

  49.                         If kkk = Cells(3, 11) Then
  50.                            kkk = 0
  51.                            sss = False
  52.                         End If
  53.                         
  54.                     Else
  55.                         Cells(U + 1, W) = "©]¯Z"
  56.                         Cells(U + 1, W).Font.Color = RGB(114, 0, 55)
  57.                         Cells(U + 1, W).Interior.Color = RGB(255, 208, 0)
  58.                     End If
  59.                     
  60.                         If Cells(U + 1, W) <> "¥ð°²" And Cells(U + 1, W) <> "¤W¯Z" Then yyy = yyy + 1
  61.                         Cells(1, 13) = yyy 'Àx¦s©µ¦ù¤Ñ¼Æ
  62.                         If yyy = Cells(3, 11) Then yyy = 0
  63.                            
  64.                     End Select
  65.                     
  66.                 End If
½Æ»s¥N½X
ÁÂÁ¤j¤j­Ìªº«ü¾É




Åwªï¥úÁ{ ³Â»¶®a±Ú°Q½×ª©ª© (http://forum.twbts.com/)