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

[µo°Ý] For...Next °ÝÃD

[µo°Ý] For...Next °ÝÃD

­ì¥»§Q¥ÎFor...Next + IF §PÂ_¦¡±NSheet1.Cells(k, 2)ªº­È¨Ì±ø¥óÂà¸m¦Ü¨ä¥LÄæ¦ì¡A¦ý¦]IFªº±ø¥ó¦¡Åܦ¨°ÊºA¡A­Y±N±ø¥ó¸ê®Æ©ñ¸mCÄæÀx¦s®æ¡A
½Ð±Ð¦p¦ó§Q¥ÎFor°j°é(CÄæ§PÂ_­È)¨ú¥N­ì¥»ªºIF §PÂ_¦¡¡A±N²Å¦X¸ê®Æ¨Ì§ÇÂà¸m¨ä¥LÄæ¦ì¡A¸Ô²Ó¸ê®Æ¦pªþ¥ó¡C«ÜÁÂÁ¤j®aªºÀ°¦£^^

Sub Macro1()

    For k = 2 To Sheet1.[A65535].End(xlUp).Row

     If Sheet1.Cells(k, 2) = "A" Then
     
        Sheet1.Cells(k, 1).Copy _
          Destination:=Sheet1.Range("D65536").End(xlUp).Offset(1)
         
     End If

     If Sheet1.Cells(k, 2) = "B" Then
     
        Sheet1.Cells(k, 1).Copy _
          Destination:=Sheet1.Range("E65536").End(xlUp).Offset(1)
         
     End If

     If Sheet1.Cells(k, 2) = "C" Then
     
        Sheet1.Cells(k, 1).Copy _
          Destination:=Sheet1.Range("F65536").End(xlUp).Offset(1)
         
     End If

    Next

TEST.zip (6.69 KB)

¤p«Ä

  1. Sub Macro1()
  2. Set c = [C2:C6]
  3.     For k = 2 To Sheet1.[A65535].End(xlUp).Row
  4.     i = Application.Match(Cells(k, 2), c, 0)
  5.     If Err.Number = 0 Then
  6. Cells(k, 1).Copy Cells(65536, i + 3).End(3)(2, 1)
  7. End If
  8.     Next
  9. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¤Hªº²´·úªø¦b«e­±¡A¥u¬Ý¨ì§O¤Hªº¯ÊÂI¡Aµ·²@¬Ý¤£¨ì¦Û¤vªº¯ÊÂI¡C
ªð¦^¦Cªí ¤W¤@¥DÃD