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

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

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

¤j®a¦n

sub addcomma¬O¦X¨Ö©Ò»Ý­n¸ê®Æ¦X¨Ö¦¨¦X¨Ö¸ê®Æªº¼Ò¼Ë

http://forum.twbts.com/viewthread.php?tid=10512&highlight=

¦h±ostillfish00¤j¤jªºÀ°§U¤w¥i±N©Ò»Ý¸ê®Æ¦X¨Ö

¦ý§Ú¼g¤F¤@­Ó¬P´Á¤´¥¼¥i¼g¥X
¿ï¨ú¸ê®Æ«á°õ¦æaddcomma¶K¨ì©Ò»Ý¦ì¸m
¦A§R°£µL¥Î¸ê®Æ...

¸Õ¤F¥ÎResize°µ¿ï¨ú¸ê®Æ
OFFSET°µ²¾°Ê
¦ý¦]¦³i¬OÅܼÆ
¦æ¼Æ¤]¬OÅܼƦÓÅܱo§xÃø...

½Ð°Ýi = ÅܼƮɪº¨Ï¥Î¤Wªº¯µ³Z?
§Y
i = Worksheets("sheet1").Range("a2").End(xlDown).Row
¤§Ãþ
A2¤S¥i¥H«ç¼Ë­«·s©w¸q?


Book1-1.zip (11.8 KB)

ÁÂÁÂ

¦^´_ 1# joslau
  1. Option Explicit
  2. Sub Ex()
  3.     Dim Ar(), i As Integer, S As Integer
  4.     i = 2
  5.     With ActiveSheet
  6.         Do While .Cells(i, "C") <> ""
  7.             If .Cells(i, "A") & .Cells(i, "B") <> "" Then
  8.                 S = S + 1
  9.                 ReDim Preserve Ar(1 To 4, 1 To S) '°}¦C:­«¸m ²Ä¤Gºûªº¤¸¯À¤W­­­È
  10.                 Ar(1, S) = .Cells(i, "A")
  11.                 Ar(2, S) = .Cells(i, "B")
  12.                 Ar(3, S) = .Cells(i, "C")
  13.                 Ar(4, S) = .Cells(i, "C")
  14.             Else
  15.                 Ar(4, S) = Ar(4, S) & "," & .Cells(i, "C")
  16.             End If
  17.             i = i + 1
  18.         Loop
  19.         .Range("F2").Resize(S, 4) = Application.Transpose(Ar)
  20.     End With
  21. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ 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

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

¦^´_ 2# GBKEE
¦^´_ 3# stillfish00


¥ýÁÂÁÂ
¨â¦ì´£ÂI¨Ñ¥X­ì©l½X§@°Ñ¦Ò
»Ý­n®É¶¡¬ã¨s

¦]³æ¸¹·|¦³ªøµu
¦X¨Ö®É¦]¹Lªø¦³¾÷·|¼Æ¾ÚÅܦ¨"12,345,678,911,234,500,000"µ¥µ¥
»Ý­n¥[ " ' "¦bÀY

¦p¦A¦³°ÝÃD©Î¦¨ªG
·|¦A¦^ÂÐ¥DÃD

TOP

¤w¸Ñ¨M
  1. rngTarget.Cells(j, 3).Value = rngTarget.Cells(j, 3).Value & "," & ar(i, 3)
½Æ»s¥N½X
§ï¦¨
  1. rngTarget.Cells(j, 3).Value = [color=Red]"'" &[/color] rngTarget.Cells(j, 3).Value & "," & ar(i, 3)
½Æ»s¥N½X
§Ú·|¦A¬ã¨s¥H¤W­ì©l½Xªº¥Îªk


ÁÂÁÂ!!!

TOP

        ÀR«ä¦Û¦b : ¦Û¤v®`¦Û¤v¡A²ö¹L©ó¶ÃµoµÊ®ð¡C
ªð¦^¦Cªí ¤W¤@¥DÃD