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

[µo°Ý] ¦p¦ó¨Ï¥ÎVBA©Î¨ç¼Æ°µ¦h­Ó°}¦C¼Æ­Èªº¤ñ¸û¤Î®æ¦¡¤Æ±ø¥óªº³]©w

¦^´_ 2# Hsieh


    ¤£¦n·N«ä,ª©¥D¦A«×¥´ÂZ±z,­è¤~§Ñ°Oªþ¤W¤å¦rÀÉ.
¦pªG¦U°}¦C¦ì§}ªº­È§¡¤£¬Û¦P,«hµø¬°100%,¥N½X7ªºÃC¦â,¤£ª¾¬O§_¥i¦æ,·PÁ±z¡C


test-g2.zip (800 Bytes)

TOP

¦^´_  Hsieh


    ¹ê¦b¤j¤jªº·PÁÂHsieh ¶W¯Åª©¥Dªº³»¤O¨ó§U,½Ð°Ýª©¥D±z¤j·§¼g³o­Óµ{¦¡ªá¤F¦h¤Ö®É¶¡,¤p ...
cmo140497 µoªí©ó 2012-12-17 09:12


¥Î¦h¤Ö®É¶¡¨Ã¤£­«­n¡A¬O§_¹F¨ì»Ý¨D¤~¬O­«ÂI
¦Ü©óMyRng¬O­n¤ñ¹ï§ïÅÜÃC¦âªº°Ï°ì
¦Ü©ó§A­n¦h­Ó½d³ò´N¬Ý§Aªºªí®æ¤À§G³W«h¦Ó©w
¤W¶ÇÀɮ׸ոլݧa
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 2# Hsieh


    ¹ê¦b¤j¤jªº·PÁÂHsieh ¶W¯Åª©¥Dªº³»¤O¨ó§U,½Ð°Ýª©¥D±z¤j·§¼g³o­Óµ{¦¡ªá¤F¦h¤Ö®É¶¡,¤p§Ì¬Q±ßpoªº,¤~­è¤W¯Z¥´¶}¹q¸£´N¦¬¨ì¦^ÂФF,¹ê¦b¥O¤p§Ì¦³ÂI....:'(

¥tÁÙ¦³¤@­Ó°ÝÃD·Q½Ð±Ðª©¥D,Ãö©ó©³¤U³o¦æ,³o°}¦C¬O¤p§Ì¦Û¤v¥Îºâªº,½Ð°Ý­n¦p¦ó¦Û¦æ°µ°}¦C¤§¹Bºâ(¤ñ¸û/¦X¨Ö),±N¦³­«ÂЩοW¥ß­È¥N¦Ü·sªº°}¦C¤º,¤´Ä~Äò°µ±ø¥ó®æ¦¡¤Æ¦Ê¤À¤ñ,
Set MyRng = .[M3:Q7]
¦]¬°³o°}¦C¦³¥i¯àx/y·|¦³20~50¤§¦h,¦pªG¥i¥H¦Û¦æ¤ñ¸û¥Xµ²ªGªº¸Ü.....¦A«×·PÁª©¥D¤£Ã㨯­Wªº¸Ñ¨M·s¤â¤p§Ìªº§xÂZ,¹ê¦b·P®¦!

TOP

¦^´_ 1# cmo140497
¸Õ¸Õ¬Ý
  1. Sub AddCheckBox() '¥[¤J®Ö¨ú¤è¶ô
  2. '¦]¬°¨S¦³´£¨Ñ¤å¦rÀÉ¡A¥H²{¦³Item§@¬°·s¼W±ø¥ó
  3. With Sheet1
  4. .CheckBoxes.Delete
  5. k = Application.CountIf(.Columns("E"), "ID")
  6. Set A = .Columns("F").Find("Item", lookat:=xlPart)
  7. For i = 1 To k
  8.   With .CheckBoxes.Add(.Cells(i + 4, "C").Left, .Cells(i + 4, "C").Top, .Cells(i + 4, "C").Width, .Cells(i + 4, "C").Height)
  9.      .Characters.Text = A
  10.   End With
  11.   Set A = .Columns("F").FindNext(A)
  12. Next
  13. End With
  14. End Sub
  15. Sub ¤ñ¹ï()
  16. Dim Sp As Shape, Rng As Range, A As Range, MyRng As Range
  17. With Sheet1
  18.    For Each Sp In .Shapes
  19.      If Sp.Name Like "Check Box*" Then
  20.      Set A = .Columns("F").Find(Sp.OLEFormat.Object.Caption)
  21.       If Sp.OLEFormat.Object.Value = 1 Then
  22.       If Rng Is Nothing Then
  23.          Set Rng = A.Offset(1, 0).Resize(5, 5)
  24.          Else
  25.          Set Rng = Union(Rng, A.Offset(1, 0).Resize(5, 5))
  26.        End If
  27.        End If
  28.      End If
  29.     Next
  30.     Set MyRng = .[M3:Q7]
  31. If Not Rng Is Nothing Then
  32.   For i = 1 To 5
  33.      For j = 1 To 5
  34.      If MyRng(i, j) <> 0 And MyRng(i, j) <> "___" Then
  35.        For Each ar In Rng.Areas
  36.          If ar(i, j) = MyRng(i, j) Then p = p + 1
  37.        Next
  38.        s = p / Rng.Areas.Count: p = 0
  39.        n = Application.Lookup(s, Array(0, 0.1, 0.2, 0.4, 0.6, 0.8, 1), Array(1, 2, 3, 4, 5, 6, 7))
  40.        MyRng.Cells(i, j).Interior.ColorIndex = .[S2:Y2].Cells(1, n).Interior.ColorIndex
  41.        Else
  42.        MyRng.Cells(i, j).Interior.ColorIndex = -4142
  43.     End If
  44.      Next
  45.   Next
  46. End If
  47. End With
  48. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : ¡i¦æµ½­n¤Î®É¡j¦æµ½­n¤Î®É¡A¥\¼w­n«ùÄò¡C¦p¿N¶}¤ô¤@¯ë¡A¥¼¿N¶}¤§«e¤d¸U¤£­n°±º¶¤õ­Ô¡A§_«h­«¨Ó´N¤Ó¶O¨Æ¤F¡C
ªð¦^¦Cªí ¤W¤@¥DÃD