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

[µo°Ý] excel vba §å¦¸±N¬Y­Ósheet¥t¦scsvÀÉ

[µo°Ý] excel vba §å¦¸±N¬Y­Ósheet¥t¦scsvÀÉ

¥»©«³Ì«á¥Ñ joey0415 ©ó 2013-8-1 00:59 ½s¿è

¤p§Ì¦³°Ñ¦Òhttp://forum.twbts.com/thread-6347-1-1.html¡A¥i¥H«ü©wsheet¡A±N¨ä¦s¦¨csvÀÉ

°ÝÃD¬O³o¼Ë

¤p§Ì±Nºô­¶¤Wªº¸ê®Æ©ñ¶isheet2¤¤¡A«ü©wsheet2¦s¦¨csvÀÉ¡A³æ¤@­Ó¨S¦³°ÝÃD
­Y¬O±NAºô­¶¤U¸ü«á¡A©ñ¦ÜSHEET2¤¤¡A¦sÀɦ¨¥\¡A¤§«á­Y±NSHEET2.CELLS.CLEAR«á
¦A±NBºô­¶¤U¸ü¡A©ñ¶iSHEET2¡A¦A¦sÀɮɷ|µo¥Í°ÝÃD¡A°ÝÃD¦p¹Ï

¤£¹L­Y±NSHEET2.CELLS.CLEAR³o¥y¸Üµù¸Ñ«á¡Aµ{¦¡¥i¥H¶]§¹¨S¦³°ÝÃD¡A¦ý¬OÀɮתº¤º®e¶V¨Ó¶V¨Ó¡A¸ê®Æ¦³­«ÂÐ

¤£¤§¬O­þ¤è­±ªº°ÝÃD¡A½Ð°ª¤â«üÂI¤@¤U

¥H¤U¬O¿ù»~»y¥y

¥H¤U¬OÀÉ®×¼g¤J¬OªÅ­È

±NSHEET2.CELLS.CLEAR«á¡A¥i¥Hrun¦ý¬O¸ê®Æ¬O¿ù»~ªº

sheet2¤¤¸ê®Æªíªº¤º®e¦p¤U
  1. ³¡¥÷¥N½X¦p¤U¡G


  2.         Dim myTxtFile As String, myFNo As Integer
  3.         Dim myLastRow As Long
  4.            
  5.         
  6.         
  7.         
  8.         Worksheets(2).Activate
  9.         CSVText = ThisWorkbook.Path & "\" & Format(Date, "yyyymmdd") & "_" & Sheet1.Cells(j, 1) & ".csv"
  10.         ar = Sheet2.Range("A1").CurrentRegion.Value
  11.         Open CSVText For Output As #1
  12.         For i = 1 To UBound(ar, 1)
  13.         mystr = Join(Application.Index(ar, i), ",")
  14.         Print #1, mystr
  15.         Next
  16.         Close #1
  17.         
  18. '        Sheet2.Cells.Clear
  19.     Next
½Æ»s¥N½X

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

TOP

§å¦¸±Nsheets¦s¦¨csvÀɪº»y¥y
ºô¤Wª¦¤å¨Ã¿ù»~¹Á¸Õ«á¡A§ä¨ì¥i¥H¥Îªº¥y¤l

¨Ò¦p¡G§Úactivateªº¬OWorksheets(2).Activate³o­Ó¤u§@ªí
§Ú´N±NWorksheets(2)¤u§@ªí¦s¦bC¤¤ªºMarthinus.csv
ActiveWorkbook.SaveAs "C:\Marthinus.csv", fileformat:=6
­Y¬O¤U­±³o¥y
'------------------------------ ±Nsheet2¤¤ªº¸ê®Æ¥H«ü©w®æ¦¡¦s¦¨csvÀÉ--------------
    ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & Format(Date, "yyyymmdd") & "_" & Sheet1.Cells(j, 1) & ".csv", FileFormat:=6

¦pªG¬O­«ÂЦ^°é¤U¸ü¿é¥XCSVªº¸Ü¡A½Ð°O±o­n±N±zªº«ü©wªºWorksheets(2)¤º®e²M°£Sheet2.Cells.Clear
³o¼ËSHEET2¤¤ªº¸ê®Æ¤~·|¬O§A·Q­n¦sªº¤º®e

TOP

¦^´_ 2# GBKEE

ÁÂÁÂGBKEE¤j
§Ú¤w§ä¨ì¤èªk¡A¶K¦b¤U­±¡A­Y¦A¦³°ÝÃD¡A¤@©w·|¦A½Ð¯q

·PÁÂ

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦¨´N¤@¤Á¡j®É¶¡¥i¥H³y´N¤H®æ¡A¥i¥H¦¨´N¨Æ·~¡A¤]¥i¥HÀx¿n¥\¼w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD