- ©«¤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
|
¦^´_ 8# cmo140497
AUTO_OPEN() Àɮ׶}±Ò®É¦Û°Ê°õ¦æ- Option Explicit
- Sub AUTO_OPEN() '¥[¤J®Ö¨ú¤è¶ô'¦]¬°¨S¦³´£¨Ñ¤å¦rÀÉ¡A¥H²{¦³Item§@¬°·s¼W±ø¥ó
- Dim A As Range, K As Integer, i As Integer
- With Sheet1
- .CheckBoxes.Delete
- .Range("B:Z").Interior.ColorIndex = xlNone
- K = Application.CountIf(.Columns("A"), "ID")
- Set A = .Columns("A").Find("ID", lookat:=xlPart)
- For i = 1 To K
- Cells(i + 5, "AA").Select
- With .CheckBoxes.Add(.Cells(i + 5, "AA").Left, .Cells(i + 5, "AA").Top, .Cells(i + 5, "AA").Width, .Cells(i + 5, "AA").Height)
- .Characters.Text = "Item" & i
- .Name = "Item" & i
- .OnAction = "EX" 'CheckBoxes «ü¥¨¶°ªº µ{¦¡
- End With
- A.Offset(1, 1).Resize(24, 24).Name = "_Item" & i '¸ê®Æ½d³ò³]¥ß¦WºÙ:¦p¤u§@ªí©w¸q¦WºÙ
- Set A = .Columns("A").FindNext(A)
- Next
- '** »s©w¦Ê¤À¤ñ ¬° 7 µ¥¤À [S1:Y1] ¦Ê¤À¤ñ¥Ñ¤j¨ì¤p ***
- For i = 1 To 7 '¦Ê¤À¤ñ¥Ñ¤j¨ì¤p
- .[AA2].Cells(1, i) = 1 + (1 / 7) - (i / 7)
- Next
- End With
- End Sub
- Sub EX() '¤w°õ¦æAUTO_OPEN, «ö¿ïCheckBoxesªºµ{¦¡
- Dim Rng(0 To 25) As Range, S, i
- Dim P As Integer, B As CheckBox, E As Variant
- With Sheet1
- .Range("B:Z").Interior.ColorIndex = xlNone
- For Each B In .CheckBoxes
- If B = 1 Then 'CheckBoxe¡F¤Ä¿ï = 1
- P = P + 1
- If Not Rng(0) Is Nothing Then
- Set Rng(0) = Union(Rng(0), .Range("_" & B.Name))
- For i = 1 To 24 '¤w¤Ä¿ï½d³ò¤§ ²Ä1Äæ-²Ä24Äæ
- For Each E In Rng(0).Areas
- Set Rng(i) = Union(E.Columns(i), Rng(i)) '¦P¤@Äæ¦ì ³]¬°¦P¤@½d³ò
- Next
- Next
- Else
- Set Rng(0) = .Range("_" & B.Name)
- For i = 1 To 24
- Set Rng(i) = Rng(0).Columns(i)
- Next
- End If
- End If
- Next
- If P = 0 Then Exit Sub
- Application.ScreenUpdating = False
- For i = 1 To 24 '½d³ò¦³24Äæ
- .Columns(Columns.Count - 1) = "" '²M°£ ³Ì«á²Ä2Äæ¸ê®Æ
- .Columns(Columns.Count) = "" '²M°£ ³Ì«á1Äæ¸ê®Æ
- Rng(i).Copy Cells(1, Columns.Count) '½Æ»sÄ檺¸ê®Æ
- .Columns(Columns.Count).AdvancedFilter xlFilterCopy, .Cells(1, Columns.Count - 1), Unique:=True
- '¶i¶¥¿z¿ï:¿ï¨ú¤£«½Æªº¸ê®Æ,´î¤Ö°j°é.
- .Columns(Columns.Count - 1).Sort Key1:=.Cells(1, Columns.Count - 1), Order1:=xlDescending, Header:=xlNo
- '±Æ§Ç : ¤£nªº¸ê®Æ¸m©ó©³³¡
- Set Rng(25) = .Columns(Columns.Count - 1).Cells(1) '³]©wn´M§äªº¦r¦ê
-
- With Rng(i)
- Do Until Rng(25) = "___" Or Rng(25) = "0" Or Rng(25) = ""
- Set Rng(0) = .Find(Rng(25), lookat:=xlWhole)
- If Not Rng(0) Is Nothing Then
- .Replace Rng(25), "=xxx", xlWhole '¦p¦P¤u§@ªí´M§ä:¥þ³¡¨ú¥N ¬°¿ù»~ªº¤½¦¡
- .SpecialCells(xlCellTypeFormulas).Select
- S = Application.CountA(Selection) / P
- If S <= 1 Then
- S = Application.Match(S, [AA2:AG2], -1) 'Match ªº±Æ§Ç:¤j¨ì¤p
- Else
- S = 1
- End If
- Selection.Value = Rng(25) '´_ì ¨ú¥Nªº¦r¦ê
- Selection.Interior.ColorIndex = Sheet1.[AA2].Cells(1, S).Interior.ColorIndex
- End If
- Set Rng(25) = Rng(25).Offset(1) '´M§ä¤U¤@Ó¦r¦ê
- Loop
- End With
- Next
- .Columns(Columns.Count - 1) = "" '²M°£ ³Ì«á²Ä2Äæ¸ê®Æ
- .Columns(Columns.Count) = "" '²M°£ ³Ì«á1Äæ¸ê®Æ
- Application.ScreenUpdating = True
- .CheckBoxes(Application.Caller).TopLeftCell.Select
- End With
- End Sub
½Æ»s¥N½X |
|