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

[µo°Ý] ½Ð±Ð­n¦p¦ó¨Ï¥Î VBA §P§O¤£³W«hÀx¦s®æªº¿ìªk2

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2013-12-7 16:05 ½s¿è

¦^´_ 22# ML089
Nice Job¡A´£¨ú¨ìArray¥[³t«Ü¦h¡A
§Ú¤]µo²{§Úªº¤èªkÅÞ¿è¤W¦³°ÝÃD¡A
¥t¥~¡ATime­ì¥»´N¥u¦³¨ì¬í¦Ó¤w¡A®É¶¡¶Ã¸õ¬O¦]¬°§A§â inputbox ªº®É¶¡¤]ºâ¤F¡C

TOP

¦^´_ 23# ML089
½Ð±Ð¡G
  1.     '  ¡õ ­pºâ¨C²Õ­Ó¼Æ¡C ª`·N! Frequency ¦^¶Ç i + 1 ²Õ¡A©Ò¥ý±N i - 1
  2.     Bins_array = Application.Evaluate("Row(1:" & i - 1 & ")")
  3.     ArrN = Application.Frequency(Arr, Bins_array)
  4.     MaxN = Application.Max(ArrN)

  5.     '  ¡õ ²Î­p¨C²Õ­Ó¼Æ¡C ª`·N! Frequency ¦^¶Ç i + 1 ²Õ¡A©Ò¥ý±N MaxN - 1
  6.     Bins_array = Application.Evaluate("Row(1:" & MaxN - 1 & ")")
  7.     ArrF = Application.Frequency(ArrN, Bins_array)
½Æ»s¥N½X
Bins_array¡BArrN ¡BMaxN ¡BArrF  ªº¤º²[¤Î§@¥Î¡A¯à§_¥[¥H¸ÑªR¡A
§Ú¹ï¤@¨Ç¥Î»y¤£«Ü±E±x¡A¥B¤ÏÀ³¸û¿ð¶w¡AÁÂÁÂÅo¡I

TOP

¦^´_ 22# ML089

³o¬ODEBUD¹ï¸Ü®Ø¿é¤J1®É¡A¥i¥H²£¥Í°}¦C³B²z«áªº¸ê®Æ¥H¨Ñ¬d®Ö

   
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 22# ML089
Timer¨Ï¥Îªº©Ç©Çªº¡A¦³®ÉÀþ¶¡°õ¦æ§¹¦¨«oÅã¥Ü9.X¬í¡ATimer¤ÎTimeE­pºâ¥X¨Ó¤]®t«Ü¦h(1.5¬í¤Î1.0¬í)¡A´X¥G®t1.5­¿¡A¤j®a¥i¥HÀ°§Ú¬Ý¬Ý¶Ü?
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 19# c_c_lai
¦^´_ 13# Hsieh
¦^´_ 4# stillfish00

§Ú°µ3­Ó¼Ð·Ç¹Ï«¬¤Î²Î­p¼Æ¶q¥H¨Ñ¤j®a´ú¸Õ¥Î
§Úªºµ{¦¡¤]±Ä¥Î»¼°j©I¥s¤è¦¡³B²z¡A­ì¹Ï§Î°õ¦æ®É¶¡¤j·§2~3¬í´N¯à§¹¦¨¡C
³oµ{¦¡¼g±o«ÜºC«Ü¤[¡A¨C­Ó«ü¥O³£¬O±qºô¸ô¤W©Î°Ñ¦Ò¤j®aªºµ{¦¡ºCºC°ï¥X¨Óªº¡A¤@¦@ªá¤F7~8¤p®É¤~§¹¦¨¡A¤]º¡¦³¦¨´N·P¡A½Ð¦³»yªk«Ý§ï¶i¤§³B½Ð¤j®a¦h¦h«ü±Ð¡C
¤U¤è¬°´ú¸ÕÀÉ®×
­±¿n¤j¤p¤À§G²Î­p_ML089.rar (139.12 KB)
   
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2013-12-7 08:42 ½s¿è

¦^´_ 20# c_c_lai
20# ªº Ex() ¤º¤§ C¡BD Äæ¤@¦æ¤@¦æ¦a¥h»¼¼W¬O¬°¤F­n
Æ[¹î¸ê®Æ³B²z¤Î¹Lµ{¡C¥H¤U¬°§ï¥H "¦r¨å" ³B¸Ì¡G
  1. Sub ex2()
  2.     Dim dic As Object, dic2 As Object
  3.     Dim A As Range, Rng As Range
  4.    
  5.     Set dic = CreateObject("Scripting.Dictionary")
  6.     Set dic2 = CreateObject("Scripting.Dictionary")
  7.     dic("³sÄò¼Æ¶q") = "¼Æ¶q"
  8.     dic2("³sÄò¦ì§}") = "²Õ¦X¼Æ¶q"
  9.    
  10.     With ¤u§@ªí1
  11.         Set Rng = .Range("A1").CurrentRegion
  12.         Rng.Replace 0, Empty, xlWhole
  13.         
  14.         Set A = Rng.Find(Empty)
  15.         
  16.         Do Until A Is Nothing
  17.             A = 0: s = 1
  18.             Cnt A
  19.             dic(s) = dic(s) + 1
  20.             dic2(sRng) = Range(sRng).Count
  21.             
  22.             Set A = Rng.Find(Empty)
  23.         Loop
  24.     End With
  25.    
  26.     With ¤u§@ªí2
  27.         .[A1].Resize(dic.Count, 1) = Application.Transpose(dic.keys)
  28.         .[B1].Resize(dic.Count, 1) = Application.Transpose(dic.items)
  29.         .[A1].Resize(dic.Count, 2).Sort key1:=.[A1], Header:=xlYes
  30.         .[C1].Resize(dic2.Count, 1) = Application.Transpose(dic2.keys)
  31.         .[D1].Resize(dic2.Count, 1) = Application.Transpose(dic2.items)
  32.    End With
  33.    
  34.     '  MsgBox dic.Count - 1
  35.     Set dic = Nothing
  36.     Set dic2 = Nothing
  37. End Sub
½Æ»s¥N½X
·PÁ Hsieh ª©¤jªº«ü¾É¡I

TOP

¦^´_ 16# ML089
Hsieh ª©¤j¥L¬OÀ³¥Î "»¼°j" ªº³B²z§Þ¥©¡A¨Ó¨D¥X¦UÂkÄݰ϶ôªº½d³ò¡A
³oºØÂI¤Î©ó­±ªº¹B¥Î¬O­ÓÆZ¤£¿ùªº Idea¡A§A¬Ý¬Ýµ{¦¡½X²Ó²Ó¦a¥h±ÀºV¡A
¬OÆZ­È±o¦^¨ýªº¡A ¦bùØÀY§Ú¥[¤W¤F sRng ªº¦ì§}¬ö¿ý³B²z¡A¨Ã¦P®É¨D¨ú
¨C­Ó°Ï¶ôªº¹ê»Ú¦ì§}¼Æ¡A¥H´£¨Ñ°Ñ¦Ò¤§¥Î¡G
  1. Option Explicit

  2. Public s As Long
  3. Public sRng As Variant

  4. Sub ex()
  5.     Dim dic As Object
  6.     Dim A As Range, Rng As Range, sPos As Range
  7.    
  8.     Set dic = CreateObject("Scripting.Dictionary")
  9.     dic("³sÄò¼Æ¶q") = "¼Æ¶q"
  10.     '   ¼W¦C³¡¤À
  11.     ¤u§@ªí2.[C1] = "³sÄò¦ì§}"
  12.     ¤u§@ªí2.[D1] = "²Õ¦X¼Æ¶q"
  13.    
  14.     With ¤u§@ªí1
  15.         Set Rng = .Range("A1").CurrentRegion
  16.         Rng.Replace 0, Empty, xlWhole
  17.         
  18.         Set sPos = ¤u§@ªí2.[C2]
  19.         Set A = Rng.Find(Empty)
  20.         
  21.         Do Until A Is Nothing
  22.             A = 0: s = 1
  23.             Cnt A
  24.             dic(s) = dic(s) + 1
  25.             
  26.             sPos = sRng
  27.             sPos.Offset(0, 1) = Range(sRng).Count
  28.             
  29.             Set A = Rng.Find(Empty)
  30.             
  31.             Set sPos = sPos.Offset(1)
  32.         Loop
  33.     End With
  34.    
  35.     With ¤u§@ªí2
  36.         .[A1].Resize(dic.Count, 1) = Application.Transpose(dic.keys)
  37.         .[B1].Resize(dic.Count, 1) = Application.Transpose(dic.items)
  38.         .[A1].Resize(dic.Count, 2).Sort key1:=.[A1], Header:=xlYes
  39.     End With
  40.    
  41.     '  MsgBox dic.Count - 1
  42.     Set dic = Nothing
  43. End Sub

  44. Function Cnt(Rng As Range)
  45.     Dim A As Range, Temp As Range
  46.     Dim i As Integer
  47.         
  48.     For Each A In Rng
  49.         For i = -1 To 1 Step 2
  50.             If A.Row + i > 0 And A.Row + i < ¤u§@ªí1.Range("A1").CurrentRegion.Rows.Count Then
  51.                 If IsEmpty(A.Offset(i, 0)) Then Set Temp = Union(Rng, A.Offset(i, 0))   '  "$BF$4:$BF$5"
  52.             End If
  53.         Next
  54.         For i = -1 To 1 Step 2
  55.             If A.Column + i > 0 And A.Column + i < ¤u§@ªí1.Range("A1").CurrentRegion.Columns.Count Then
  56.                 If IsEmpty(A.Offset(, i)) Then Set Temp = Union(Rng, A.Offset(, i))   '  "$BF$4:$BG$4"
  57.             End If
  58.         Next
  59.     Next

  60.     If Not Temp Is Nothing Then      '  True
  61.         Temp = 0
  62.         s = Temp.Count
  63.         sRng = Temp.Address
  64.         Cnt Temp
  65.     End If
  66. End Function
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2013-12-7 08:05 ½s¿è

¦^´_ 16# ML089
¥H±`²z¨Ó½×¡A 10 »P 25 À³µL©¼¦¹¶¡¤§¦êÁp¡AÀ³Äݤ£¦P¤§°Ï¶ô¤~¬O¡A
§A¦b¹ê§@¤W¬O¦p¦ó¸ÑªRªº¡H

TOP

¦^´_ 13# Hsieh
¦^´_ 16# ML089
¦^´_ 11# stillfish00
­±¿n¤j¤p¤À§G²Î­pB.rar (108.71 KB)
·PÁ¦U¦ìªºÀ°¦£¡A¦pÁÙ¦³§ó¨Î®Ä¯qªº¸Ñ¨M¤è®×¡A
·q½Ð¤£§[«ü±Ð¡I

TOP

¦^´_ 13# Hsieh
¦^´_ 16# ML089
¦^´_ 11# stillfish00
ÁÂÁ¤j®a¡A²×©ó´ú¸Õ¥Xµ²ªG¤F¡AÁöµM³t«×¤WµyµyºC¤FÂI¡G

TOP

        ÀR«ä¦Û¦b : ¨ü¤HÂI¤ô¤§®¦¡A¶··í´é¬u¥H³ø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD