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

[µo°Ý] ¥Îexcel¥´¶}µ§°O¥»

[µo°Ý] ¥Îexcel¥´¶}µ§°O¥»

¥»©«³Ì«á¥Ñ an13755 ©ó 2012-1-4 23:29 ½s¿è

¦U¦ì¤j®v¦n

¤p¤k¤l¦³1°ÝÃD½Ð±Ð,·Q½Æ»s¤u§@ªí1½d³òa1:a20

¥´¶}µ§°O¥»µ{¦¡¶K¤W,¨Ã±N¨äÀx¦s¦¨ÀɦW"1.txt"

Àx¦s¸ô®|¬°C:\Documents and Settings\Administrator\My Documents\·s¸ê®Æ§¨

¤u§@ªí±q1¨ì50,Á`¦@­n°µ50¦¸1¼Ëªº°Ê§@

ÁٽЦU¦ì¤j®vÀ°¦£,¦h¤è¨ó§U,¤£³Ó·P¿E

ps:exclÀɦW¬°"csv.xls"
an

1.ExcelÀɧA´N¦Û¤v«Ø¥ß§a¡I
2.¦]¬°¦s¨úC:\Documents and Settings\Administrator·|¦³Åv­­°ÝÃD¡A©Ò¥H§Ú§ï¬°D:\
3.50­Ósheet¹ê¦b¬O¤ÓÀ½¤F¡A©Ò¥H§ï¦¨°ÊºA°»´ú¡A¤£ºÞ¥Ø«e¶}±Òªº¬¡­¶Ã¯¦³´X­Ósheet¡A·|Â^¨ú¨C¤@­ÓsheetªºA1:A20¼Æ­È¼g¤J1.txt

Sub WriteTxtFile()
Dim WriteFile As String
WriteFile = "D:\1.txt"
Open WriteFile For Output As #1

SheetsCount = Application.Sheets.Count

'¼g¤J¸ê®Æ
For i = 1 To SheetsCount
    Sheets(i).Select
    For j = 1 To 20
        Print #1, Cells(j, 1)
    Next j
Next i
Close #1
End Sub

TOP

LCC¤j®v±z»~¸Ñ§Úªº·N«ä¤F

¤u§@ªí1­nÀx¦s¦¨ÀɦW"1.txt"

¤u§@ªí2­nÀx¦s¦¨ÀɦW"2.txt"
.
.
¤u§@ªí50­nÀx¦s¦¨ÀɦW"50.txt"

Á`¦@­n¦s50­ÓÀÉ®×

½Ð¤Å¥Î°ÊºA°»´ú,¦]¬°ÁÙ¦³¨ä¥L¤£»Ý­n½Æ»sªº¤u§@ªí

«D±`·PÁ±zªº¦^µª
an

TOP

¦^´_ 3# an13755

ªì¾ÇªÌVBA
  1. Sub ZZ()
  2. Application.ScreenUpdating = False
  3. For i = 1 To 50
  4.   Set sht = Worksheets.Add(After:=Sheets(Sheets.Count))
  5.   Sheets(i).Range("A1:A20").Copy sht.Cells(1, 1)
  6.   sht.Move
  7.   With ActiveWorkbook
  8.     ChDir "C:\"
  9.     ActiveWorkbook.SaveAs Filename:="C:\" & i & ".txt", FileFormat:=xlText, CreateBackup:=False
  10.     .Close True
  11.   End With
  12. Next i
  13. Application.ScreenUpdating = True
  14. End Sub
½Æ»s¥N½X

TOP

r¤j®v±z¦n

µ{¦¡°õ¦æ¥X²{2­Ó°ÝÃD

²Ä1­Ó°ÝÃD:1.txtÀÉ®×¥´¶}¨S¦³ªF¦è

²Ä2­Ó°ÝÃD:¨ä¥L¦³½Æ»sªºtxtÀÉ,¤º®e¬Ò·|¥X²{¦h¾lªº²Å¸¹""

¤p¤k¤l²{¤W¶ÇexclÀɤΤâ°Ê½Æ»s§¹¦¨ªº2­ÓtxtÀÉ

ÁٽФj®vÀ°¦£,ÁÂÁÂ!! csv.rar (5.1 KB)
an

TOP

¦^´_ 5# an13755
­×§ï¤@¤U
  1. Option Explicit
  2. Sub ZZ()
  3.     Dim Rng As Range, i As Integer
  4.     Application.ScreenUpdating = False
  5.     For i = 1 To 50
  6.         ' i ¬O¼Æ¦r        ->Sheets(i)   ¬¡­¶Ã¯µøµ¡¤W²Ä´X­Ó¤u§@ªí
  7.         'i & "" Åܦ¨¦r¦ê  ->Sheets(& "") ¤u§@ªíi
  8.         Set Rng = Sheets(i & "").Range("A1:A20")  'Rng³]©w¬° ¤u§@ªíiªº½d³ò
  9.         With Workbooks.Add(1)                     '·s¼W¬¡­¶Ã¯(¤u§@ªí1±i)
  10.             Rng.Copy .Sheets(1).Cells(1)          '½Æ»s¨ì·s¼W¬¡­¶Ã¯²Ä1 ±i¤u§@ªíªº[A1]
  11.             .SaveAs Filename:="D:\" & i & ".txt", FileFormat:=xlText, CreateBackup:=False
  12.             .Close True
  13.     End With
  14.     Next i
  15.     Application.ScreenUpdating = True
  16. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ an13755 ©ó 2012-1-5 16:20 ½s¿è

g¤j®v±z¦n

¥´¶}txtÀɮפº®e,¨C1¦æ«e«á¬Ò·|¥X²{¦h¾lªº²Å¸¹"

Æ[¹î«áµo²{¥u­n­ìexcelÀɤW¦r§À¦³³r¸¹,´N·|¥X²{""²Å¸¹

ÁÂÁ¤j®vªºÀ°¦£!!
an

TOP

¦^´_ 7# an13755
½Ð¦Û¦æ®ø°£ ,
1= 4 6 7 13 14 32 37,
1= 9 15 20 27 28 33 36 38,
1= 1 2 17 18 19 21 22 26 30,
1= 3 23 24 29 34,
1= 5 8 10 11 12 16 25 31 35 39,
6= 7 9 10 16 17 35 40,

TOP

g¤j®v±z¦n

³r¸¹¬O¥²­nªº¦r¤¸,¤£¯à®ø¥h

ÁÂÁ¤j®vªºÀ°¦£!!
an

TOP

¦^´_ 9# an13755
  1. Option Explicit
  2. Sub Ex()
  3.     Dim Rng As Range, i As Integer, Fs As Object, A As Object, E As Range
  4.     Application.ScreenUpdating = False
  5.     Set Fs = CreateObject("Scripting.FileSystemObject") 'FileSystemObject ª«¥ó ´£¨Ñ¹ï¹q¸£Àɮרt²Îªº¦s¨ú¡C
  6.     For i = 1 To 50
  7.         Set Rng = Sheets(i & "").Range("A1:A20")  'Rng³]©w¬° ¤u§@ªíiªº½d³ò
  8.         Set A = Fs.CreateTextFile("D:\" & i & ".txt", True)    '«Ø¥ß¤å¦rÀÉ®×
  9.         'CreateTextFile ¤èªk «Ø¥ß¤@­Ó«ü©wªºÀɦW¨Ã¥B¶Ç¦^¤@­Ó¥Î©ó¸ÓÀÉ®×Ū¼gªº TextStream ª«¥ó¡C
  10.         '¦pªG¥i³QÂл\¨ä­È¬° True¡A¨ä¬° False ®ÉµLªkÂл\
  11.         For Each E In Rng
  12.             A.WriteLine (E)
  13.         Next
  14.         A.Close
  15.     Next i
  16.     Application.ScreenUpdating = True
  17. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¡i¬O§_µo´§¤F¨}¯à¡H¡j¤H¶¡¹Ø©R¦]¬°µu¼È¡A¤~§óÅã±o¬Ã¶Q¡CÃø±o¨Ó¤@½ë¤H¶¡¡AÀ³°Ý¬O§_¬°¤H¶¡µo´§¤F¦Û¤vªº¨}¯à¡A¦Ó¤£­n¤@¨ý¨Dªø¹Ø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD