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

[µo°Ý] ½Ð±ÐEXCEL¤º®e¸ê®Æ¶×¥X¦¨TXTÀɪº³]©w

[µo°Ý] ½Ð±ÐEXCEL¤º®e¸ê®Æ¶×¥X¦¨TXTÀɪº³]©w

½Ð±Ð¤@¤U
¦]¬°¦³¤u§@»Ý¨D¡A»Ý­n±NEXCELªí¤¤ªº¸ê®Æ·J¾ã¨Ã¶×¦¨TXTÀÉ
¦@¦³´X¸Uµ§¡K©Ò¥H¦b³o¦V¦U¦ì½Ð±Ð¡A½Ð¨£½Ì¡C
¦pªG·Q­n±NEXCELªí®æ¤¤ªº¸ê®Æ¡A¶×¥X¦¨TXTÀÉ
¤@¡B¤u§@ªí1
A1Äæ¦ì¡GAAAAA
B1¡ãB20¡G¼Æ¦rB1¡ãB20(°²³]¨ì²Ä20¦C)
C1¡ãC20¡G¼Æ¦rC1¡ãC20(°²³]¨ì²Ä20¦C)
D1¡ãD20¡G¼Æ¦rD1¡ãD20(°²³]¨ì²Ä20¦C)

¡÷¶×¥XTXTÀÉÅܦ¨¡G_AAAAA B1 C1D1 B2 C2 D2 B3 C3 D3 B4 C4 D4¡K¡K
³Æµù¡G
⑴¦Û°Ê§PÂ_¦pªGB¡BC¡BDÄæ¶ñ¤Jªº¼Æ¦r¥u¦³²Ä10¦Cªº¸Ü¡A_AAAAA «á­±´N¥u·|¶ñ¨ì²Ä10¦Cªº¼Æ¦r
⑵A1Äæ¦ì´N¬Ý¿é¤J¤°»ò­^¤å¦r¡A¦bTXT´NÅã¥Ü_­^¤å¦r
⑶¨C­Ó­^¤å¦r¤Î¼Æ¦r¶¡¥H¡uªÅ®æ¡v

¤G¡B¤u§@ªí2
A1Äæ¦ì¡GAAA¡]­^¤å¦r¡^
B1Äæ¦ì¡GBBB¡]­^¤å¦r¡^
C1Äæ¦ì¡GCCC¡]­^¤å¦r¡^
D1¡ãD20¡G¼Æ¦r(°²³]¨ì²Ä20¦C)
¡÷¶×¥XTXTÀÉÅܦ¨¡G
①_AAA (BBB_D1 BBB_D2 BBB_D3 BBB_D4¡K) CCC
②¦pªGDÄæ¦ì¥u¦³D1¦³¼Æ¦rªº¸Ü¡]D2¡ãD20ªÅ¥Õªº¸Ü¡^¡A´NÅܦ¨_AAA BBB_D1 CCC
③¦Û°Ê§PÂ_¦pªGDÄæ¶ñ¤Jªº¼Æ¦r¥u¦³²Ä10¦Cªº¸Ü¡A¥u·|¥[¨ìBBB_ «á­±´N¥u·|¶ñ¨ì²Ä10¦Cªº¼Æ¦r¡C
④A1¡BB1¡BC1Äæ¦ì´N¬Ý¿é¤J¤°»ò­^¤å¦r¡A¦bTXT´NÅã¥Ü_­^¤å¦r
⑤¨C­Ó­^¤å¦r¤Î¼Æ¦r¶¡¥H¡uªÅ®æ¡v

¤£¦n·N«ä¡A¥i¥H«ü¾É¤@¤U¶Ü¡HÁÂÁ¦U¦ì«e½ú«ü±Ð¡ã

¦^´_ 1# ianlcc
¬Ýªº²´ªá,½Ð¤W¶ÇExcelÀÉ,TxtÀÉ,
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_  ianlcc
¬Ýªº²´ªá,½Ð¤W¶ÇExcelÀÉ,TxtÀÉ,
GBKEE µoªí©ó 2014-2-18 16:48


txt.rar (8.36 KB)
§Ú¤w¸g±N½d¨Òªþ¤WÀÉ®×
¦@¦³¥|­ÓÀÉ®×
¤@­ÓEXCEL¹ïÀ³¤T­ÓTXTÀÉ
½Ð°Ñ¦Ò¡IÁÂÁ¡ã

TOP

¦^´_ 3# ianlcc
   
¤G¡B¤u§@ªí2
A1Äæ¦ì¡GAAA¡]­^¤å¦r¡^
B1Äæ¦ì¡GBBB¡]­^¤å¦r¡^
C1Äæ¦ì¡GCCC¡]­^¤å¦r¡^            'ªþÀɬO¼Æ¦r
D1¡ãD20¡G¼Æ¦r(°²³]¨ì²Ä20¦C)        'ªþÀɬO­^¤å¦r
¡÷¶×¥XTXTÀÉÅܦ¨¡G
①_AAA (BBB_D1 BBB_D2 BBB_D3 BBB_D4¡K) CCC
②¦pªGDÄæ¦ì¥u¦³D1¦³¼Æ¦rªº¸Ü¡]D2¡ãD20ªÅ¥Õªº¸Ü¡^¡A´NÅܦ¨_AAA BBB_D1 CCC  'ªþÀɬOC1
③¦Û°Ê§PÂ_¦pªGDÄæ¶ñ¤Jªº¼Æ¦r¥u¦³²Ä10¦Cªº¸Ü¡A¥u·|¥[¨ìBBB_ «á­±´N¥u·|¶ñ¨ì²Ä10¦Cªº¼Æ¦r¡C
  1. Option Explicit
  2. Sub Ex_txt(Sh As String, A As String) '¿é¥X¤å¦rÀÉ
  3. Dim fs As Object
  4. Set fs = CreateObject("Scripting.FileSystemObject")
  5. Set fs = fs.CreateTextFile("d:\" & Sh & ".txt", True)
  6. fs.WriteLine (A)
  7. fs.Close
  8. End Sub
  9. Sub Ex_¤u§@ªí1()
  10. Dim C As Range, A As String
  11. With Sheets("¤u§@ªí1")
  12. A = "_" & .Range("a1")
  13. For Each C In .UsedRange.Columns("B:D").Rows
  14. A = A & " " & Join(Application.Transpose(Application.Transpose(C.Value)), " ")
  15. Next
  16. Ex_txt .Name, A
  17. End With
  18. End Sub
  19. Sub Ex_¤u§@ªí2()
  20. Dim C As Range, A As String, Ar
  21. With Sheets("¤u§@ªí3")
  22. For Each C In .UsedRange.Columns(3).Cells 'C1Äæ¦ì¡GCCC¡]­^¤å¦r¡^'ªþÀɬO¼Æ¦r
  23. A = A & .Range("B1") & "_" & C & " "
  24. Next
  25. If .UsedRange.Columns(3).Cells.Count > 1 Then
  26. A = "_" & .Range("a1") & " (" & Mid(A, 1, Len(A) - 1) & ") " & .Range("D1")
  27. Else 'DÄæ¦ì¥u¦³D1¦³¼Æ¦rªº¸Ü¡]D2¡ãD20ªÅ¥Õªº¸Ü¡^¡A´NÅܦ¨_AAA BBB_D1 CCC 'ªþÀɬOC1
  28. A = "_" & .Range("a1") & " " & A & .Range("D1")
  29. End If
  30. Ex_txt .Name, A
  31. End With
  32. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

·P®¦±zªº¨ó§U¤ÎÀ°¦£
§Ú­è­è´ú¸Õ¤F¤@¤U¡Aµo²{¦³¤@­Ó°ÝÃD
§Ú­nRUN¤u§@ªí2ªº®É­Ô¡A¦sÀɬO¦s¡u¤u§@ªí3¡vªº¦WºÙ¡A¦Ó¥Bµ²ªG¤]¬O¤u§@ªí3ªº¤º®e
¤u§@ªí2ªº¸ê®ÆµLªk¥Í¦¨TXTÀÉ¡I

¦^´_  ianlcc
GBKEE µoªí©ó 2014-2-19 08:08

TOP

±z¦n
§Ú­è­è­×¥¿¤F¤@¤U
§âWith Sheets("¤u§@ªí3")§ï¦¨With Sheets("¤u§@ªí2")
´N¥¿±`¤F
«D±`ªº·PÁ±zªºÀ°¦£¡A§Ú¦ARUN RUN¡ã
¤£µMªº¸Ü¡A§Ú¥ú¬O1¸U¦hµ§¸ê®Æ¡A§Ú·|ºÆ±¼¡I¡I

·P®¦±zªº¨ó§U¤ÎÀ°¦£
§Ú­è­è´ú¸Õ¤F¤@¤U¡Aµo²{¦³¤@­Ó°ÝÃD
§Ú­nRUN¤u§@ªí2ªº®É­Ô¡A¦sÀɬO¦s¡u¤u§@ªí3¡vªº¦WºÙ ...
ianlcc µoªí©ó 2014-2-19 11:45

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¤Hªº§Ö¼Ö¡D¤£¬O¦]¬°¥L¾Ö¦³±o¦h¡A¦Ó¬O¦]¬°¥L­p¸û±o¤Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD