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

[µo°Ý] ½Ð±Ð¦U¦ì ¦p¦ósplit«á±N(¤å¦r)Âà´«¬°(¼Æ¦r)

[µo°Ý] ½Ð±Ð¦U¦ì ¦p¦ósplit«á±N(¤å¦r)Âà´«¬°(¼Æ¦r)

Dear ¦U¦ì¤j¤j¤Îª©¥D±z¦n :
¤p§Ì¦³¤@¨ç¼ÆÂà´«°ÝÃD,½Ð°Ý¦bsplit(string," ")(0)«á,¦p¦ó±N¹ê¬°"000"Âà´«¬°¼Æ¦r"0"©Î"001"Âà´«¬°¼Æ¦r"1"©O?·P®¦!
  1. Sub ¥¨¶°2()
  2.     Dim MyTEXT As String, ar, j As Integer
  3.    
  4.     MyTEXT = "AAA:000 001 002 003"
  5.     j = 1
  6.     If MyTEXT Like AAA & "*" Then
  7.             Cells(1, j).Value = Split(MyTEXT, ":")(0)
  8.             ar = Split(Split(MyTEXT, ":")(1), " ")
  9.             Cells(1, j + 1).Resize(, UBound(ar) + 1) = ar
  10.             'Result : Cells(1,1)=AAA , Cells(1,2)=000 , Cells(1,3)=001 , Cells(1,4)=002, Cells(1,5)=003
  11.             '¦p¦ó±N000 001 002 003 Âà´«¬°¼Æ¦rCells(1,2)=0 , Cells(1,3)=1 , Cells(1,4)=2, Cells(1,5)=3
  12.     End If
  13. End Sub
½Æ»s¥N½X
2013-01-16 µo°Ý¦r¦êÂà¼Æ¦r°ÝÃD.zip (10.7 KB)

¦^´_ 1# cmo140497
CInt(expression)  ¨ç¼Æ¥iÂର¾ã¼Æ¸ê®Æ , expression ¤Þ¼Æ½d³ò¶·¦b -32,768 ¦Ü 32,767

TOP

¦^´_ 2# stillfish00


    ¤£¦n·N«ä,½Ð±Ð­n¥[¦b­þ?·|¤ñ¸û¾A·í,¤@ª½¥X²{alarm message:«¬ºA¤£²Å,ÁÂÁ±z¤£§[«ü±Ð,·P®¦!

TOP

¦^´_ 3# cmo140497
ar = Split(Split(MyTEXT, ":")(1), " ")
'´¡¤J©³¤U°j°é
For i = LBound(ar) To UBound(ar)
    ar(i) = CInt(ar(i))
Next

TOP

¥»©«³Ì«á¥Ñ Hsieh ©ó 2013-1-16 17:38 ½s¿è

¦^´_ 1# cmo140497


  ¹ï©ó°}¦C¤¸¯Àªº¸ê®Æ­×§ï¥²¶·¤@¤@­×§ï
µLªk§Q¥Î¸ê®Æ«¬ºAÂà´«¨ç¼Æ¤@¦¸©ÊªºÂà´«
            ar = Split(Split(MyTEXT, ":")(1), " ")
            For i = 0 To UBound(ar)
               Cells(1, j + 1 + i) = CItn(ar(i))
            Next
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 4# stillfish00


    ¹ê¦b·PÁ±zªº¤£§[«ü±Ð,¤p§Ì§âCintª½±µ«a¦bar«e,¤~·|¥X¿ù,¤Ó·PÁ±z¤F,·P®¦!

TOP

¦^´_ 1# cmo140497
  1. Sub ¥¨¶°2()
  2.     Dim MyTEXT As String, ar, j As Integer   
  3.     MyTEXT = "AAA:000 001 002 003"
  4.     j = 1
  5.     If MyTEXT Like AAA & "*" Then
  6.             Cells(1, j).Value = Split(MyTEXT, ":")(0)
  7.             ar = Split(Split(MyTEXT, ":")(1), " ")
  8.             With Cells(1, j + 1).Resize(, UBound(ar) + 1)
  9.                 .Value = ar
  10.                 .Value = .Value       '½d³òªº­È=½d³òªº­È
  11.             End With
  12.             'Result : Cells(1,1)=AAA , Cells(1,2)=000 , Cells(1,3)=001 , Cells(1,4)=002, Cells(1,5)=003
  13.             '¦p¦ó±N000 001 002 003 Âà´«¬°¼Æ¦rCells(1,2)=0 , Cells(1,3)=1 , Cells(1,4)=2, Cells(1,5)=3
  14.     End If
  15. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : Ãø¦æ¯à¦æ¡AÃø±Ë¯à±Ë¡AÃø¬°¯à¬°¡A¤~¯àª@µØ¦Û§Úªº¤H®æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD