| ©«¤l5923 ¥DÃD13 ºëµØ1 ¿n¤À5986 ÂI¦W0  §@·~¨t²Îwin10 ³nÅ骩¥»Office 2010 ¾\ŪÅv150 ©Ê§O¨k ¨Ó¦Û¥xÆW°ò¶© µù¥U®É¶¡2010-5-1 ³Ì«áµn¿ý2022-1-23 
         
 | 
                
| ¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-12-20 09:44 ½s¿è 
 16# Àɮתºµ{¦¡½X,¸Õ¬Ý¬Ýµ{¦¡³B¸Ìªº³t«×¬O§_º¡·N!!
 ¦^´_ 19# cmo140497½Æ»s¥N½XOption Explicit
Const xRow As Integer = 24
Const xCol As Integer = 24
Private Sub AUTO_OPEN()
    Dim Rng As Range, E As Range, xi As Integer
    Sheets("Overlap").Activate
    Set Rng = [A:A]
    Rng.Replace "ID", "=XXX", xlWhole
    Set Rng = Rng.SpecialCells(xlCellTypeFormulas, xlErrors)
    ActiveSheet.CheckBoxes.Delete
    For Each E In Rng.Cells
        With Cells(xi + 5, "AA")
            With ActiveSheet.CheckBoxes.Add(.Left, .Top, .Width, .Height)
                .Caption = "Item" & xi + 1
                .OnAction = "Ex_Action"
                E.Offset(1, 1).Resize(xRow, xCol).Name = "_" & .Caption  '³]¸m½d³ò¦WºÙ
            End With
        End With
        xi = xi + 1
    Next
    Rng.Value = "ID"
End Sub
Private Sub Ex_Action()
    Dim cBox As Object, Rng As Range, r As Integer, y As Integer, xi As Integer
    Dim Ar(), E As Variant, t As Date
    t = Time
    For Each cBox In ActiveSheet.CheckBoxes
        If cBox.Value = 1 Then
            If Rng Is Nothing Then Set Rng = Range("_" & cBox.Caption)
            If Not Rng Is Nothing Then Set Rng = Union(Rng, Range("_" & cBox.Caption))
        End If
    Next
    With Range("AI5").Resize(xRow, xCol)
        .Interior.ColorIndex = xlNone
        For Each cBox In .Cells
            If cBox <> "___" Then cBox = 0
        Next
    End With
    Application.ScreenUpdating = False
    Range("B:Z").Interior.ColorIndex = xlNone
    If Rng Is Nothing Then Exit Sub
    ReDim Ar(1 To xRow, 1 To xCol)                                      '³]©w:°}¦C¤j¤p
    '********  ¨C¤@Ó½d³ò¤¤¦P¤@¦ì¸m¦³¸ê®Æªº:p¼Æ
    For Each cBox In Rng.Areas                                          '³B¸Ì¨C¤@Ó½d³ò
        For r = 1 To xRow
            For y = 1 To xCol
                If cBox(r, y) = "___" Then GoTo 0                       '¤£³B¸Ì
                If cBox(r, y) <> 0 Then Ar(r, y) = Ar(r, y) + 1         '¬ö¿ý¸ê®Æ
0:
            Next
        Next
    Next
    '********  ¨C¤@Ó½d³ò¤¤¦P¤@¦ì¸m¸ê®Æªºp¼Æ¦Ê¤À¤ñ:³]¤UÃC¦â
    For Each cBox In Rng.Areas
        For r = 1 To xRow
            For y = 1 To xCol
                xi = 0                                                  '¦Ê¤À¤ñ:Âk¹s
                If cBox(r, y) = "___" Then GoTo 1
                For Each E In Array(0, 0.19, 0.39, 0.59, 0.79, 0.99, 1)
                    xi = xi + 1
                    If Ar(r, y) / Rng.Areas.Count <= E Then Exit For    '¨ú±o¦Ê¤À¤ñ
                Next
                If Ar(r, y) > 0 Then cBox(r, y).Interior.ColorIndex = [AA2].Cells(1, xi).Interior.ColorIndex
                                                                        '[AA2].Cells(1, xi):ÃC¦âªº¦ì¸m
1:
            Next
        Next
    Next
    '********  ²Îp½d³ò¦ì¸m¸ê®Æ: p¼Æ, ¦Ê¤À¤ñÃC¦â
    With Range("AI5")
        For r = 1 To xRow
            For y = 1 To xCol
                If .Cells(r, y) <> "___" Then
                    .Cells(r, y) = IIf(Ar(r, y) = "", 0, Ar(r, y))
                    If Ar(r, y) > 0 Then
                    .Cells(r, y).Interior.ColorIndex = Rng(r, y).Interior.ColorIndex
                    Else
                    .Cells(r, y).Interior.ColorIndex = [AA2].Interior.ColorIndex
                    End If
                End If
            Next
        Next
    End With
    Application.ScreenUpdating = True
    MsgBox Format(t, "¶}©l hh:mm:ss") & vbLf & Format(Time, "µ²§ô hh:mm:ss") & vbLf & vbLf & Format(Time - t, "¶O®É hh:mm:ss")
End Sub
 | 
 |