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

[µo°Ý] ¸ê®Æ¤ñ¸û«áºI¥X©Ò»Ý¸ê®Æ

¦^´_ 1# jcchiang
  1.     Sub ex()
  2. Dim Rng As Range
  3. With Sheet2
  4.   r = 2
  5.   Do Until .Cells(r, 1) = ""
  6.   a = .Cells(r, 1)
  7.   With Sheet1
  8.      Set c = .Columns("A").Find(a, lookat:=xlWhole)
  9.      If Not c Is Nothing Then
  10.      Set c = c.MergeArea.Resize(, 6)
  11.         If Rng Is Nothing Then
  12.            Set Rng = c
  13.         Else
  14.            Set Rng = Union(Rng, c)
  15.         End If
  16.      End If
  17.   End With
  18.   r = r + 1
  19.   Loop
  20. End With
  21. With Sheet3
  22.   .UsedRange.Offset(1).Clear
  23.   Rng.Copy .[A2]
  24. End With
  25. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 4# jcchiang
  1. Sub ex()

  2. Dim Rng As Range, a, b As Range, c As Range

  3. With Sheet2
  4.   r = 2
  5.   Do Until .Cells(r, 1) = ""
  6.   a = .Cells(r, 1)
  7.   With Sheet1
  8.   Set c = Nothing
  9.     For Each b In .Range(.[A2], .[A65536].End(xlUp))
  10.         If b = a Then
  11.            If c Is Nothing Then
  12.            Set c = b.MergeArea.Resize(, 6)
  13.            Else
  14.            Set c = Union(c, b.MergeArea.Resize(, 6))
  15.            End If
  16.         End If
  17.     Next
  18.      If Not c Is Nothing Then
  19.         If Rng Is Nothing Then
  20.            Set Rng = c
  21.         Else
  22.            Set Rng = Union(Rng, c)
  23.         End If
  24.      End If
  25.   End With
  26.   r = r + 1
  27.   Loop
  28. End With
  29. With Sheet3
  30.   .UsedRange.Offset(1).Clear
  31.   Rng.Copy .[A2]
  32. End With
  33. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : ¡i»X½ªªº¦Û¥Ñ¡j¤H±`¦b¤°»ò³£¥i¥H¦Û¥Ñ¦Û¦bªº®É­Ô¡A«o³Q³oºØÀH¤ß©Ò±ýªº¦Û¥Ñ»X½ª¡AµêÂY®É¥ú¦Ó²@µLıª¾¡C
ªð¦^¦Cªí ¤W¤@¥DÃD