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

[µo°Ý] ¦p¦ó²¤Æ¥¨¶°

[µo°Ý] ¦p¦ó²¤Æ¥¨¶°

¥»©«³Ì«á¥Ñ luke ©ó 2012-3-31 23:15 ½s¿è

¦U¦ì¥ý¶i!

§Ú¿ý»s¤F¤A­Ó¥¨¶°, ·Ð½Ð¥ý¶i²¤Æ.

Sub Macro1()
    Range("A17").Select
    ActiveCell.FormulaR1C1 = _
        "=IF(R[-2]C="""","""",VLOOKUP(R[-2]C,sheet2!R2C1:R[5]C[5],3,0))"
    Range("A18").Select
    ActiveCell.FormulaR1C1 = _
        "=IF(R[-3]C="""","""",VLOOKUP(R[-3]C,sheet2!R2C1:R[4]C[5],4,0))"
    Range("A19").Select
    ActiveCell.FormulaR1C1 = _
        "=IF(R[-4]C="""","""",VLOOKUP(R[-4]C,sheet2!R2C1:R[3]C[5],5,0))"
    Range("A20").Select
    ActiveCell.FormulaR1C1 = _
        "=IF(R[-5]C="""","""",VLOOKUP(R[-5]C,sheet2!R2C1:R[2]C[5],6,0))"
    Range("A17:A20").Select
    Selection.Copy
    Range("a17:K20").Select
    ActiveSheet.Paste
    Range("a24:K27").Select
    ActiveSheet.Paste
    Range("a31:K34").Select
    ActiveSheet.Paste
    Range("a38:K41").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
End Sub

¦^´_ 1# luke

½Ð¤W¶ÇEXCELÀ£ÁYÀÉ,¨Ã»¡©ú©Ò»Ý¤§¥\¯à­n¨D

TOP

¥»©«³Ì«á¥Ñ luke ©ó 2012-4-1 22:15 ½s¿è

¦^´_ 2# register313


   ³o¬O¤p§Ì©Ò¿ý»sªº­ì©lÀÉ

  ·Ð½Ð¥ý¶i«ü¾É
[attach]10268[/attach]

TEST2B.rar (11.77 KB)

TOP

¥»©«³Ì«á¥Ñ register313 ©ó 2012-4-1 23:14 ½s¿è

¦^´_ 3# luke
  1. Sub XX()
  2. Set Rng = Union([A15:K15], [A22:K22], [A29:K29], [A36:K36])
  3. For Each R In Rng
  4.     Set s = Sheets("Sheet2").[A:A].Find(R, , , xlWhole)
  5.     If Not s Is Nothing Then
  6.        R.Resize(6, 1) = Application.Transpose(s.Resize(1, 6))
  7.     End If
  8. Next
  9. End Sub
½Æ»s¥N½X

TOP

¦^´_ 3# luke
  1. Sub nn()
  2. Set d = CreateObject("Scripting.Dictionary")
  3. With sheet2
  4.    For Each a In .Range(.[A1], .[A1].End(xlDown))
  5.       d(a.Value) = a.Offset(, 1).Resize(, 5).Value
  6.    Next
  7. End With
  8. With sheet1
  9. For Each a In .UsedRange.SpecialCells(xlCellTypeConstants, xlNumbers)
  10.    a.Offset(1).Resize(UBound(d(a.Value), 2), 1) = Application.Transpose(d(a.Value))
  11. Next
  12. End With
  13. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ register313 ©ó 2012-4-1 23:36 ½s¿è

¦^´_ 5# Hsieh

­YÀx¦s®æ¬°¼Æ¦r¦ý¨Ã«D¦r¨å¸ÌªºÃöÁä¦r,¸Ó¦p¦ó¨¾¿ù
  1. Sub nn()
  2. Set d = CreateObject("Scripting.Dictionary")
  3. With sheet2
  4.    For Each a In .Range(.[A1], .[A1].End(xlDown))
  5.       d(a.Value) = a.Offset(, 1).Resize(, 5).Value
  6.    Next
  7. End With
  8. With sheet1
  9. For Each a In .UsedRange.SpecialCells(xlCellTypeConstants, xlNumbers)
  10.    If d.Exists(a.Value) Then
  11.       a.Offset(1).Resize(UBound(d(a.Value), 2), 1) = Application.Transpose(d(a.Value))
  12.    End If
  13. Next
  14. End With
  15. End Sub
½Æ»s¥N½X

TOP

¦^´_ 6# register313
  1. Sub Ex()
  2.     Dim A As Range, F As Range
  3.     For Each A In sheet1.UsedRange.SpecialCells(xlCellTypeConstants, xlNumbers)
  4.         Set F = sheet2.[A:A].Find(A, lookat:=xlWhole)
  5.         With A.Offset(1).Resize(5)
  6.             .Value = ""
  7.             If Not F Is Nothing Then .Value = Application.Transpose(F.Offset(, 1).Resize(, 5).Value)
  8.         End With
  9.     Next
  10. End Sub
  11. Sub Ex1()
  12.     Dim A As Range, F As Variant
  13.     For Each A In sheet1.UsedRange.SpecialCells(xlCellTypeConstants, xlNumbers)
  14.          F = Application.Match(A, sheet2.[A:A], 0)
  15.         With A.Offset(1).Resize(5)
  16.             .Value = ""
  17.             If Not IsError(F) Then .Value = Application.Transpose(sheet2.Cells(F, "A").Offset(, 1).Resize(, 5).Value)
  18.         End With
  19.     Next
  20. End Sub
½Æ»s¥N½X

TOP

¦^´_ 6# register313

With sheet1
For Each a In Union(.[A15:K15], .[A22:K22], .[A29:K29], .[A36:K36]).SpecialCells(xlCellTypeConstants)
   a.Offset(1).Resize(UBound(d(a.Value), 2), 1) = Application.Transpose(d(a.Value))
Next
End With
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : ¦³Ä@©ñ¦b¤ß¸Ì¡A¨S¦³¨­Åé¤O¦æ¡A¥¿¦p¯Ñ¥Ð¤£¼½ºØ¡A¬Ò¬OªÅ¹L¦]½t¡C
ªð¦^¦Cªí ¤W¤@¥DÃD