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

[µo°Ý] i¬Æ»ò®É­Ô+¼Æ , ¤S«ç¼Ë¥i¥HÅܦ^¹s¤S¨ì¬ÛÃö¦ì¸m¦A¦¸­pºâ?

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2014-2-14 14:09 ½s¿è

¦^´_ 1# joslau
°Ñ¦Ò:
  1. Sub Test()
  2.   Dim rngSource As Range, rngTarget As Range
  3.   Dim ar, i As Long, j As Long
  4.   
  5.   With Sheets("Sheet1")
  6.     Set rngSource = .[A1].CurrentRegion.Resize(, 3) '¨Ó·½
  7.     Set rngTarget = .[G1].Resize(rngSource.Rows.Count, 3) '¦X¨Öµ²ªG
  8.    
  9.     '§R°£Âªºµ²ªG
  10.     If rngTarget.Cells(1).Value <> "" Then rngTarget.Cells(1).CurrentRegion.ClearContents
  11.    
  12.     '¦X¨Ö
  13.     ar = rngSource.Value  '¤@¦¸©Ê¨ú¥X
  14.     For i = 1 To UBound(ar)
  15.       If ar(i, 1) <> "" Then
  16.         j = j + 1
  17.         rngTarget.Cells(j, 1).Resize(, 3) = Application.Index(ar, i)
  18.       Else
  19.         rngTarget.Cells(j, 3).Value = rngTarget.Cells(j, 3).Value & "," & ar(i, 3)
  20.       End If
  21.     Next
  22.   End With
  23. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : «H¤ß¡B¼Ý¤O¡B«i®ð¤TªÌ¨ã³Æ¡A«h¤Ñ¤U¨S¦³°µ¤£¦¨ªº¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD