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

[µo°Ý] ¨D§U~Ãö©óvbaªºµ{¦¡!

¦^´_ 4# candy516
³Ì¥D­n¬O¬Ý¤£À´§A©Ò¿×°£Åv®§ªº¼Ð¬O­n¶ñ¦b­þ¸Ì?
½Ð¸ÕÁ|¨Ò¨Ó»¡©ú¡A§A¸ê®Æ­n«ç»ò¶ñªk
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ Hsieh ©ó 2011-1-17 16:20 ½s¿è

¦^´_ 6# candy516

§Ú¤£À´ªº¬O¡ASheet1°O¸ü¬O2010/9/7  ¬O°£Åv¤é
¦ý©p±Ô­z®É¤S¬OÅܦ¨2010/9/8
­Y±ø¥ó¨S¦¨¥ß¬O©¹«e§ä©Î¬O©¹«á§ä
§ä¨ì«á­n¦bC85¼g¤J¤°»ò­È?
¸U¤@°£Åv«á³£¨S¦^¤É¤S¸Ó¦p¦ó?
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 8# candy516
  1. Sub ex()
  2. Set d = CreateObject("Scripting.Dictionary")
  3. Application.ScreenUpdating = False
  4. With Sheet1
  5.    For Each a In .Range(.[A2], .[A2].End(xlDown))
  6.       d(a & Year(a.Offset(, 1))) = Array(a.Offset(, 1), a.Offset(, 2))
  7.    Next
  8. End With
  9. For y = 2001 To 2010
  10.   With Sheets(CStr(y))
  11.     If Application.CountBlank(.Range(.[B1], .[IV1].End(xlToLeft))) > 0 Then .Range(.[B1], .[IV1].End(xlToLeft)).SpecialCells(xlCellTypeBlanks).EntireColumn.Delete
  12.     .Range(.[IV1].End(xlToLeft).Offset(, 1), .[IV1]).EntireColumn.Clear
  13.     k = 2
  14.     Do Until .Cells(1, k) = ""
  15.     .Columns(k + 1).Insert
  16.        mystr = .Cells(1, k) & y
  17.        Set a = .Columns("A").Find(d(mystr)(0))
  18.        If Not a Is Nothing Then
  19.        cnt = 0
  20.          r = a.Row
  21.          test = .Cells(r - 1, k)
  22.          r = r + 1
  23.          cnt = cnt + 1
  24.          Do Until .Cells(r, k) >= test Or .Cells(r, k) = ""
  25.          cnt = cnt + 1
  26.          r = r + 1
  27.          Loop
  28.          If .Cells(r, 1) = "" Then
  29.          .Cells(a.Row, k + 1) = "µL¶ñÅv"
  30.          Else
  31.          .Cells(a.Row, k + 1) = cnt
  32.          End If
  33.        End If
  34.        k = k + 2
  35.     Loop
  36.   End With
  37. Next
  38. Application.ScreenUpdating = True
  39. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 10# candy516
  1. Sub ex()
  2. Set d = CreateObject("Scripting.Dictionary")
  3. Application.ScreenUpdating = False
  4. With Sheet1
  5.    For Each a In .Range(.[A2], .[A2].End(xlDown))
  6.       d(a & Year(a.Offset(, 1))) = a.Offset(, 1).Value
  7.    Next
  8. End With
  9. For y = 2001 To 2010
  10.   With Sheets(CStr(y))
  11.     If Application.CountBlank(.Range(.[B1], .[IV1].End(xlToLeft))) > 0 Then .Range(.[B1], .[IV1].End(xlToLeft)).SpecialCells(xlCellTypeBlanks).EntireColumn.Delete
  12.     .Range(.[IV1].End(xlToLeft).Offset(, 1), .[IV1]).EntireColumn.Clear
  13.     k = 2
  14.     Do Until .Cells(1, k) = ""
  15.     .Columns(k + 1).Insert
  16.        mystr = .Cells(1, k) & y
  17.        Set a = .Columns("A").Find(d(mystr))
  18.        If Not a Is Nothing Then
  19.        cnt = 0
  20.          r = a.Row
  21.          test = .Cells(r + 1, k)
  22.          cnt = cnt + 1
  23.          Do Until .Cells(r, k) >= test Or .Cells(r, k) = ""
  24.          cnt = cnt + 1
  25.          r = r - 1
  26.          Loop
  27.          If r <= 2 Then
  28.          .Cells(a.Row, k + 1) = "µL¶ñÅv"
  29.          Else
  30.          .Cells(a.Row, k + 1) = cnt
  31.          End If
  32.        End If
  33.        k = k + 2
  34.     Loop
  35.   End With
  36. Next
  37. Application.ScreenUpdating = True
  38. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 12# candy516

¦]¬°Äæ¼Æ¹L¦h¥²¶·¨Ï¥Î2007ª©¥»
  1. Sub ex()
  2. Set d = CreateObject("Scripting.Dictionary")
  3. Application.ScreenUpdating = False
  4. With Sheet1
  5.    For Each a In .Range(.[A2], .[A2].End(xlDown))
  6.       d(a & Year(a.Offset(, 1))) = a.Offset(, 1).Value
  7.    Next
  8. End With
  9. For y = 2001 To 2004
  10.   With Sheets(CStr(y))
  11.     If Application.CountBlank(.Range(.[B1], .[XFD1].End(xlToLeft))) > 0 Then .Range(.[B1], .[XFD1].End(xlToLeft)).SpecialCells(xlCellTypeBlanks).EntireColumn.Delete
  12.     .Range(.[XFD1].End(xlToLeft).Offset(, 1), .[XFD1]).EntireColumn.Clear
  13.     k = 2
  14.     Do Until .Cells(1, k) = ""
  15.     .Columns(k + 1).Insert
  16.        mystr = .Cells(1, k) & y
  17.        Set a = .Columns("A").Find(d(mystr))
  18.        If Not a Is Nothing Then
  19.        cnt = 0
  20.          r = a.Row
  21.          test = .Cells(r + 1, k)
  22.          cnt = cnt + 1
  23.          Do Until .Cells(r, k) >= test Or .Cells(r, k) = ""
  24.          cnt = cnt + 1
  25.          r = r - 1
  26.          Loop
  27.          If r <= 2 Then
  28.          .Cells(a.Row, k + 1) = "µL¶ñÅv"
  29.          Else
  30.          .Cells(a.Row, k + 1) = cnt
  31.          End If
  32.        End If
  33.        k = k + 2
  34.     Loop
  35.   End With
  36. Next
  37. Application.ScreenUpdating = True
  38. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 15# candy516

¨º­n¬Ý§Aªº®æ¦¡¬O§_¸ò¨ä¥L¦~«×¤@¼Ë
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 19# candy516
¤ñ¸û¦nªº¤è¦¡¬O§â©Ò¦³¦~«×¸ê®Æ³£¾ã²z¦b¦P¤@¤u§@ªí¤¤
¸ó¦~¸ó¤ëªº°ÝÃD´N®e©ö¸Ñ¨M
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 22# candy516
³o¼Ë¥i¯à³Â·Ð¤@ÂI
µ{¦¡±N¶ñ¤J¶ñÅv¤é¼Æ¡A¨Ã±N10¤é¤º¶ñÅv¦W³æ¦C¥X
½Ð±Nµ{¦¡½X¸m©óSheet1¼Ò²Õ
  1. Sub ¶ñÅv()
  2. Dim A As Range, Ar()
  3. Set dic = CreateObject("Scripting.Dictionary")
  4. Set myday = CreateObject("Scripting.Dictionary")
  5.           ReDim Preserve Ar(z)
  6.           Ar(z) = Array("¤½¥q", "¦~«×", "¶ñÅv¤é¼Æ")
  7.           z = z + 1

  8. Dim Sh As Worksheet
  9. For j = Sheets.Count To 1 Step -1
  10. Set Sh = Sheets(j)
  11.   With Sh
  12.      If .Name <> Me.Name Then
  13.      Set rng = .Range(.[B1], .Cells(1, .Columns.Count).End(xlToLeft))
  14.         If Application.CountBlank(rng) > 0 Then rng.SpecialCells(xlCellTypeBlanks).EntireColumn.Delete
  15.         For r = .Cells(.Rows.Count, 1).End(xlUp).Row To 3 Step -1
  16.         Set A = .Cells(r, 1)
  17.            myday(A.Value) = temp
  18.            temp = A.Value
  19.         Next
  20.         Else
  21.         For Each A In .Range(.[A2], .Cells(.Rows.Count, 1).End(3))
  22.         dic(A & Year(A.Offset(, 1))) = A.Offset(, 1)
  23.         Next
  24.     End If
  25.   End With
  26. Next
  27. For Each Sh In Sheets
  28.   With Sh
  29.   If .Name < Me.Name Then
  30.   k = 2: dn = .Name
  31.     Do Until .Cells(1, k) = ""
  32.        .Columns(k + 1).Insert
  33.        f = .Cells(1, k)
  34.        Set A = .Columns("A").Find(dic(f & dn))
  35.        If A Is Nothing Then GoTo 20
  36.        d = myday(A.Value)
  37.        With Sheets(CStr(Year(d)))
  38.           Set b = .Columns("A").Find(d)
  39.           Set c = .Rows(1).Find(f)
  40.           If b Is Nothing Or c Is Nothing Then cnt = "µL¶ñÅv": GoTo 10
  41.           x = b.Row
  42.           y = c.Column
  43.           test = .Cells(x, y)
  44.        End With
  45.        r = A.Row: cnt = 1
  46.        Do Until r = 2 Or .Cells(r, k) >= test
  47.        r = r - 1
  48.        cnt = cnt + 1
  49.        Loop
  50.        If r = 2 Then cnt = "µL¶ñÅv"
  51. 10
  52.        .Cells(A.Row, k + 1) = cnt
  53.        If IsNumeric(cnt) And cnt <= 10 Then
  54.           ReDim Preserve Ar(z)
  55.           Ar(z) = Array(f, dn, cnt)
  56.           z = z + 1
  57.        End If
  58.       
  59. 20
  60.        k = k + 2
  61.     Loop
  62.   End If
  63.   End With
  64. Next
  65. Set dic = Nothing
  66. Set myday = Nothing
  67. With Worksheets.Add
  68. .[A1].Resize(z, 3) = Application.Transpose(Application.Transpose(Ar))
  69. .Move
  70. End With
  71. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : ¤£©È¨Æ¦h¡A¥u©È¦h¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD