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

[µo°Ý]½Ð°Ý¿é¥X¦¨.TXTÀɮɥi¥H«ü©w¦bTXTÀɤ¤ªº¦ì¸m¶Ü?

[µo°Ý]½Ð°Ý¿é¥X¦¨.TXTÀɮɥi¥H«ü©w¦bTXTÀɤ¤ªº¦ì¸m¶Ü?

½Ð°Ý®æ¬°¤j¤j¡G
EXCEL¿é¥X¦¨.TXTÀɮɡA¥i¥H«ü©w¨C¤@Ä檺¸ê®Æ¶}ÀY±q­þ¤@­Ó¦ì¸m¶}©l¶Ü?

¦]¬°¿é¥X³øªí»Ý¨D¡A©Ò¦³¸ê®Æ¦C¤¤¡A¨C¤@Ä檺¸ê®Æ¶}ÀYªº¦ì¸m¥²¶·¤@­P
¦]¸ê®Æªøµu¤£¤@¡A¤S§¨Âø¤¤¡B­^¤å»P¼Æ¦r
©Ò¥H¤£ºÞ§Ú¥ÎLen¡BLenB¥hºâ¦P¤@Äõªº³Ì¤jªø«×¡A¨ä¾l¸ÉªÅ¥Õªº¤è¦¡¬ÒµLªk¶êº¡
©Ò¥H·Q½Ð°Ý¦U¦ì¤j¤j¯à§_ª½±µ«ü©w°_©l¦ì¸m?
©ÎÁÙ¦³¨ä¥L¸Ñ¨M¤è¦¡?

·P®¦
ASUS

¦^´_ 13# Hsieh
·PÁÂHsieh¤j¤j
§Ú¤j·§¦³¤C¡B¤K¦¨À´¤F
§Ú·|¸ÕµÛ¥Î³o¨Ç·§©À¨Ó¼g¤@­Ó¨ç¼Æ¡A¤w¹ý©³¤F¸Ñ¨ä¥Îªk
·PÁ±z
³o¯u¬O­ÓÂצ¬ªº¤@¤Ñ
ASUS

TOP

¦^´_ 12# asus103


    For Each A in [A1:D1]
©Ò¥HÅܼÆA¨Ì§Ç¬°A1,B1,C1,D1
adÅܼƬOÅܼÆA¨ìA©Ò¦bÄæ¦ì¸ê®Æ§À½d³òªº¦ì§}¦r¦ê
·íA=[A1]®É¡Aad="$A$1:$A$11"
·íA=[B1]®É¡Aad="$B$1:$B$11"
¥H¦¹Ãþ±À

Evaluate´N¬O­pºâ¬A¸¹¤º¦r¦ê±Ô­z
¦]¬°LEN¨ç¼Æ¦P®É¬°¤u§@ªí¨ç¼Æ»PVBA¨ç¼Æ¡A©Ò¥H¨Ï¥ÎworksheetfunctionµLªk¥¿½T¤Þ¥Î¡A·|¥X¿ù¡A¬G±Ä¥ÎEvaluate
¦Ü©ó¬O¬°¦ó¯à¹F¨ì°}¦C­pºâ®ÄªG¡AºÝ¿à¬A¸¹¤º¦r¦ê±Ô­z¡A«DEvaluate©Ò­P¡AEvaluate¤èªk·|¨Ì·Ó´y­z¹Bºâ¡A©Ò¥H¦¹¨Ò¬O¦]¬°ad¦r¦ê¬O¥Nªí¤@­Ó½d³ò¡A©Ò¥H·|¦³°}¦C®ÄªG²£¥Í

Evaluate¦b»¡©ú¤¤¤w¸g©ú¥Õ«ü¥X¡A¦¹¤èªk¬O§â¦WºÙÂà´«¦¨ª«¥ó©ÎªÌ­È
©Ò¿×¦WºÙ´N¬O¦r¦ê±Ô­z
­«ÂI¬O¦r¦ê±Ô­z¦Ó¤£¬OEvaluateªº¸ÑÄÀ¡AEvaluate´N¹³¬O­Ó¨ç¼Æ¦WºÙ
¨º»ò¥¦ªº¥\¥Î´N¬O§â¦r¦ê±Ô­zÂন¹Bºâ¡A¦p¦¹¦Ó¤w¡C
­YÁÙ¤£©ú¥Õ¡A§Ú´N¤£ª¾¸Ó¦p¦ó¸ÑÄÀ¤F¡C½Ð¹ïEvaluate¦³§ó²`»{ÃѪº«e½úÀ°¦£¸ÑÄÀ§a
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ asus103 ©ó 2011-1-19 16:52 ½s¿è

¦^´_ 11# Hsieh
·PÁÂHsieh¤j¤jªº¸Ñ»¡
§Ú¥i¥HÄ~Äò½Ð±Ð¶Ü?

1.For Each A In [A1:D1]
  ad = Range(A, Cells(Cells.Rows.Count, A.Column).End(xlUp)).Address
  ad¤£¬OA1:D11¶Ü?¬°¦ó¨C¤@¦¸²¾°Ê¤@Äæ¦Ó¤£¬O¤@­ÓÀx¦s®æ
ans:§Ú¨Ï¥Î²Ä¤@¦C§@°j°é¡A©Ò¥Had¦r¦ê¬O¶Ç¦^¸Ó¦C¸ê®Æ½d³òªº¦ì§}
¤£¦n·N«ä¡A§ÚÁÙ¬O¤£À´¬O¦p¦ó§i¶DVBA¬O¦C§@°j°éªº
2.Ar(s) = Evaluate("MAX(LENb(" & ad & "))")
¤W¦¡¤§©Ò¥H¬O°}¦C¤½¦¡¬O¦]¬°" & ad & "ÁÙ¬O Evaluate
´«¨¥¤§¡A­Y­n¦bVBA¤¤¨Ï¥Î°}¦C¤½¦¡­nª`·N¬Æ»ò
¦pªG»¡¡G
°}¦C¤½¦¡¤¤ªº{}¥ÎEvaluate()¨ú¥N¡AEXCELªº¨ç¼Æ©Ò»Ý¤Þ¼Æ©ñ¤J¦r¦ê¤¤¨Ã¥Î" &     & "¨Ó±a¤J
³o¼Ë¹ï¶Ü?

3.Evaluateªº¥Îªk§ÚÁÙ¶·¦h¥[µZ¿i¡A¥u¬O
"¨Ï¥ÎEvaluate¤èªk¤¤µ¥¦P¬O¤u§@ªí¨ç¼Æ¹Bºâ"¬°¦ó¤£¬O¨Ï¥Îapplication.---
¨ä¹ê§Ú¤]¸Õ¹L¥Îapplication.LenB()¥u¬O½sĶ¶¥¬q´N¥X¿ù¤F


¤£¦n·N«ä¡AÄ~Äò§ä±z³Â·Ð
¦pªG¦³¨ä¥L¦a¤è¦³Evaluateªº¥Îªk©Î¬OVBA¤¤¨Ï¥Î°}¦C¤½¦¡ªº¨Ï¥Î»¡©ú
·Ð½Ð§iª¾¡A§Ú·|¦A¦h¥[§V¤Oªº
ASUS

TOP

¦^´_ 10# asus103
µ{¦¡½X¤¤³\¦h¨Æ¨Ã¤£©ú¥Õ¡AÁٽЫü±Ð
1.For Each A In [A1:D1]
  ad = Range(A, Cells(Cells.Rows.Count, A.Column).End(xlUp)).Address
  ad¤£¬OA1:D11¶Ü?¬°¦ó¨C¤@¦¸²¾°Ê¤@Äæ¦Ó¤£¬O¤@­ÓÀx¦s®æ
ans:§Ú¨Ï¥Î²Ä¤@¦C§@°j°é¡A©Ò¥Had¦r¦ê¬O¶Ç¦^¸Ó¦C¸ê®Æ½d³òªº¦ì§}

2.Ar(s) = Evaluate("MAX(LENb(" & ad & "))")
   ·Pı¤W¹³EXCEL¤¤°}¦Cªº¥Îªk¡A¦ý¹ê¦b´x´¤¤£¦í¬ªù©Ò¦b¡A¯à¸ÑÄÀ¤@¤U³o­Ó¥Îªk¶Ü?
ans:³o¬O°}¦C¥Îªk¨S¿ù¡A³oµ¥©ó¦bÀx¦s®æ¤º¶ñ¤J°}¦C¤½¦¡¡A°²³]adÅܼƪº­Èµ¥©ó"$A$1:$A$11"
´Nµ¥¦P¦bÀx¦s®æ¤º¿é¤J°}¦C¤½¦¡{=MAX(LENB($A$1:$A$11))}©Ò±o¨ìªº­È¤@¼Ë

3.Evaluate("LenB(""" & test & """)") ªº¥Îªk¤]¬Ý¤£À´
  §Ú§â¥¦§ï¦¨ LenB( test) «á³v¦æ°õ¦æ®ÉÁÙOK¡A¦ý³Ì«á¦ü¥GÅܦ¨µL½u°j°é¸õ¤£¥X¨Ó
  Evaluate()¤w¤j¤jªº¥Îªk¦ü¥G¥Nªí¨ç¼Æ¬O¶Ü?¦ý»¡©ú¤¤¥u¦³¥¦¬O"¤èªk"ªº¥Îªk
4.§Ú¥Îlenb()¦bµ{¦¡¤¤±o¨ìªº²Ä2Äæ³Ì¤j­È¬°26¡A¬°¦ó¤j¤j¯à±o¥¿½Tªº22
ans3¡B4:Evaluate¦WºÙÂà´«¦¨ª«¥ó©ÎªÌ­È
©Ò¥H¥L´N¬O¤@­Óª«¥ó¥]¸Ë¤èªk¡A±N¦r¦ê´y­zÂà´«¦¨±Ô­z©Ò±o¤§­È
³oÃä­È±oª`·Nªº¬OvbaªºLENB¨ç¼Æ¸ò¤u§@ªí¨ç¼ÆLENB¦³©Ò®t²§
¨Ï¥ÎEvaluate¤èªk¤¤µ¥¦P¬O¤u§@ªí¨ç¼Æ¹Bºâ
¤u§@ªí¨ç¼ÆLENB·|¨Ì·Ó¨C­Ó¦rªº¦ì¤¸¼Æ­pºâ
vbaªºLENB¨ç¼Æ«h¨C­Ó¦r¤¸³£µø¬°2­Ó¦ì¤¸
¦¹®t²§©Ê½Ð°Ñ¾\VBAªºLENB½d¨Ò»¡©ú
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 8# Hsieh
Hsieh¤j¤j±z¦n¡G
±zªºµ{¦¡½X¯u¬O¯«¥G¨ä§Þªü
·P®¦

µ{¦¡½X¤¤³\¦h¨Æ¨Ã¤£©ú¥Õ¡AÁٽЫü±Ð
1.For Each A In [A1:D1]
  ad = Range(A, Cells(Cells.Rows.Count, A.Column).End(xlUp)).Address
  ad¤£¬OA1:D11¶Ü?¬°¦ó¨C¤@¦¸²¾°Ê¤@Äæ¦Ó¤£¬O¤@­ÓÀx¦s®æ
2.Ar(s) = Evaluate("MAX(LENb(" & ad & "))")
   ·Pı¤W¹³EXCEL¤¤°}¦Cªº¥Îªk¡A¦ý¹ê¦b´x´¤¤£¦í¬ªù©Ò¦b¡A¯à¸ÑÄÀ¤@¤U³o­Ó¥Îªk¶Ü?
3.Evaluate("LenB(""" & test & """)") ªº¥Îªk¤]¬Ý¤£À´
  §Ú§â¥¦§ï¦¨ LenB( test) «á³v¦æ°õ¦æ®ÉÁÙOK¡A¦ý³Ì«á¦ü¥GÅܦ¨µL½u°j°é¸õ¤£¥X¨Ó
  Evaluate()¤w¤j¤jªº¥Îªk¦ü¥G¥Nªí¨ç¼Æ¬O¶Ü?¦ý»¡©ú¤¤¥u¦³¥¦¬O"¤èªk"ªº¥Îªk
4.§Ú¥Îlenb()¦bµ{¦¡¤¤±o¨ìªº²Ä2Äæ³Ì¤j­È¬°26¡A¬°¦ó¤j¤j¯à±o¥¿½Tªº22

¬O§Úµ{«×¤Ó®t¤F¡A³o»ò¦h¬Ý¤£À´ªº¦a¤è
ÁٽФj¤j¦h¥[´£ÂI
·PÁ¦A·PÁÂ
ASUS

TOP

¦^´_ 8# Hsieh


    ¤j¤j¯u¬O¼F®`~
¾Ç²ß¤~¯à´£¤É¦Û¤v

TOP

¦^´_ 6# asus103
  1. Sub ex()
  2. Dim Ar()
  3. For Each A In [A1:D1]
  4. ad = Range(A, Cells(Cells.Rows.Count, A.Column).End(xlUp)).Address
  5.   ReDim Preserve Ar(s)
  6.   Ar(s) = Evaluate("MAX(LENb(" & ad & "))") '¬ö¿ý¦UÄ檺³Ì¤j¦r¤¸ªø«×
  7.   s = s + 1
  8. Next
  9. Open "ToText.txt" For Output As #1
  10. For r = 1 To Range("A" & Cells.Rows.Count).End(xlUp).Row
  11.    For i = 0 To 3
  12.      test = Cells(r, i + 1)
  13.      '¶i¦æ¥[¤JªÅ¥Õ¦r¤¸¡Aª½¨ì¦r¤¸ªø«×²Å¦X
  14.      Do Until Evaluate("LenB(""" & test & """)") = Ar(i) + 4 '4¬°Äæ¦ìªÅ¥Õ¶¡¹j
  15.      test = test & " "
  16.      Loop
  17.      mystr = mystr & test
  18.    Next
  19. Print #1, mystr
  20. mystr = ""
  21. Next
  22. Close #1
  23. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ hugh0620 ©ó 2011-1-18 17:49 ½s¿è

¦^´_ 5# asus103


    §Ú¦³°µ¤F¤@¨Ç½Õ¾ã~  ¤£¹LÁÙ¬O¦³¨Ç¦a¤è¦³ÂI¿ù»~    ½Ð¬d¾\ªþÀÉ~ ¸ê®Æªøµu¤£¤@XC.rar (101.94 KB)
¾Ç²ß¤~¯à´£¤É¦Û¤v

TOP

¦^´_ 4# hugh0620
"VBA¦V«e½Ä"¤j¤j·PÁ±z
§Ú¤]·|¦A¦n¦n¬ã¨s±zªºµ{¦¡½Xªº
ÁÂÁÂ
ASUS

TOP

        ÀR«ä¦Û¦b : ¡i¦æµ½­n¤Î®É¡j¦æµ½­n¤Î®É¡A¥\¼w­n«ùÄò¡C¦p¿N¶}¤ô¤@¯ë¡A¥¼¿N¶}¤§«e¤d¸U¤£­n°±º¶¤õ­Ô¡A§_«h­«¨Ó´N¤Ó¶O¨Æ¤F¡C
ªð¦^¦Cªí ¤W¤@¥DÃD