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

½Ð°Ý¦p¦ó±N¦sÀɦpªí®æ¤@¼Ë

¦^´_ 2# luhpro


    ÁÂÁ luhpro ¤j¤j ¡Aµ{¦¡¥i°õ¦æ ^_^
  ½Ñ°Ý ¤j¤j          MyTxt = MyTxt & Left(.Cells(i, j) & Space(16), aLen(j - 1) - Len(.Cells(i, j)) * -(i = 1))
¤¤ªº  *-(i = 1) ªº§@¥Î
ÁÂÁÂ

TOP

½Ð°Ý¦p¦ó±N¦sÀɦpªí®æ¤@¼Ë¦p¤U¹Ï¤@¼Ë¡AÁÂÁÂ
wufonna µoªí©ó 2014-9-19 20:40
  1. Sub Trans()
  2.     Dim myRng As Range
  3.     Dim i%, j%
  4.     Dim MyTxt$, filename$
  5.     Dim aLen()
  6.    
  7.     aLen = Array(8, 16, 16, 16, 16, 16, 16)
  8.     Set myRng = Range("A1").CurrentRegion '©w¸q­n§ì¨úªº½d³ò
  9.    
  10.     '©w¸qÀɦW¬°®É¶¡
  11.     filename = ThisWorkbook.Path & "\" & Format(Now(), "yyyymmddhhmmss") & ".txt"
  12.     '¶}±ÒÀÉ®×¼g¤J¡A­Y¸ô®|¤¤¥¼¦³¸ÓÀÉ®×·|create¤@­Ó
  13.     Open filename For Output As #1
  14.     '²Ä¤@¦C¤£§ì¶i¨Ó¡A¤@ª½¨ú¨ì³Ì«á¤@¦C
  15.     With myRng
  16.     For i = 1 To .Rows.Count
  17.       MyTxt = ""
  18.       For j = 1 To 7
  19.         MyTxt = MyTxt & Left(.Cells(i, j) & Space(16), aLen(j - 1) - Len(.Cells(i, j)) * -(i = 1))
  20.       Next
  21.         Print #1, MyTxt
  22.     Next
  23.     End With
  24.     Close #1
  25.     MsgBox ("¦sÀɦ¨¥\! ")
  26. End Sub
½Æ»s¥N½X
testtxt-a.zip (14.25 KB)

TOP

        ÀR«ä¦Û¦b : ¤Ó¶§¥ú¤j¡B¤÷¥À®¦¤j¡B§g¤l¶q¤j¡A¤p¤H®ð¤j¡C
ªð¦^¦Cªí ¤W¤@¥DÃD