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

[µo°Ý] ²¤Æµ{¦¡

[µo°Ý] ²¤Æµ{¦¡

¥»©«³Ì«á¥Ñ luke ©ó 2012-5-13 13:07 ½s¿è

¦U¦ì¤j¤j

¤p§Ì¥Î¿ý»s¤F¥¨¶°­×§ï¦p¤U
Sub CC()
Set fd = CreateObject("Scripting.FileSystemObject")
Application.ScreenUpdating = False
Set FT = ActiveWorkbook
FS = "D:\TEST\TEST20\" & "TT.txt"
With Workbooks.Open(FS).Sheets("TT")
     FT.Sheets("Sheet2").Columns("A:B") = .Columns("A:B").Value
    .Parent.Close False
End With
Application.ScreenUpdating = True

Set fd = CreateObject("Scripting.FileSystemObject")
Application.ScreenUpdating = False
Set FT = ActiveWorkbook
FS = "D:\TEST\TEST20\TEST\" & "TT.txt"
With Workbooks.Open(FS).Sheets("TT")
     FT.Sheets("Sheet2").Columns("G:H") = .Columns("A:B").Value
    .Parent.Close False
End With
Application.ScreenUpdating = True

Set fd = CreateObject("Scripting.FileSystemObject")
Application.ScreenUpdating = False
Set FT = ActiveWorkbook
FS = "D:\TEST\TEST20\" & "UU.csv"
With Workbooks.Open(FS).Sheets("UU")
     FT.Sheets("Sheet2").Columns("C") = .Columns("A").Value
    .Parent.Close False
End With
Application.ScreenUpdating = True
End Sub
Sub DD()
Application.ScreenUpdating = False
Set FT = ActiveWorkbook
FS = "D:\TEST\TEST20\" & "TT.txt"
With Workbooks.Open(FS).Sheets("TT")
     FT.Sheets("Sheet2").Columns("D:E").Copy .Columns("A:B")
    .Parent.Close savechanges:=True
End With
Application.ScreenUpdating = True

Application.ScreenUpdating = False
Set FT = ActiveWorkbook
FS = "D:\TEST\TEST20\TEST\" & "TT.txt"
With Workbooks.Open(FS).Sheets("TT")
     FT.Sheets("Sheet2").Columns("G:H").Copy .Columns("A:B")
    .Parent.Close savechanges:=True
End With
Application.ScreenUpdating = True
sheet2.[f1:f5] = [c1:c5].Value
    Range("F6").Select
    ActiveCell.FormulaR1C1 = "=""Count=""&COUNT(R[-5]C[-2]:RC[-2])"
    Range("F7").Select
    ActiveCell.FormulaR1C1 = "=""Lan""&R[-6]C[-2]&""=""&R[-6]C[-1]"
    Range("F7").Select
    Selection.Copy
    Range("F8:F9").Select
    ActiveSheet.Paste
    Range("F6:F9").Select
    Application.CutCopyMode = False
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
Application.ScreenUpdating = False
Set FT = ActiveWorkbook
FS = "D:\TEST\TEST20\" & "UU.csv"
With Workbooks.Open(FS).Sheets("UU")
     FT.Sheets("Sheet2").Columns("F").Copy .Columns("A")
    .Parent.Close savechanges:=True
End With
Application.ScreenUpdating = True
End Sub

·Ð½Ð¥ý¶i ¤j¤j«ü¾É²¤Æµ{¦¡

¬Ý§¹¾ã¬q«á¡K¡K³oÀ³¸Ó¬O¦b¤£¦PªºÀɮסA¹ï¤£¦Pªº°Ï°ì¡A°µ¬Û¦Pªº¨Æ±¡¡K¡K

³o©Î³\¥i¥H¥Îarray
§â"°Ï°ì"¡A"Àɮ׸ôÍß"¡A¦U§O³Ð«Øarray¡AµM«á¥Î°j°éªº¤è¦¡¨ú¥Xarray¸Ì¬Û¹ïÀ³ªº­È¡A°µ¬Û¦Pªº°Ê§@¡K¡K

´£¨ÑÂI·Qªk¡K¡K¸ÕµÛ°µ°µ¬Ý¡I
ªì¾ÇVBA¥E¨ìtwbts

TOP

¦^´_ 2# play9091


    ¦^ÂÐ ¨ô¤j¤j

   ¤p§Ì¹ï»yªk¤£¤Ó¤F¸Ñ, ¥Ø«e¥u·|¥Î«÷¸Ë¤è¦¡§â¬ÛÃöµ{¦¡´ê¦b¤@°_, ¦]¦¹¤£·|¥Îarray»yªk
   
   ÁÂÁ§Aªº«Øij

TOP

¥»©«³Ì«á¥Ñ play9091 ©ó 2012-5-13 21:58 ½s¿è

¦^´_ 3# luke


    ¸Õ¸Õ¬Ý³o¼Ë¤l¥i¤£¥i¥H§a¡I§Ú¤£ª¾¹D¦bª«¥ó¸Ì­±¥i¤£¥i¥H©ñarr()¡A¤£¦æªº¸Ü¦A§â¥¦®³¥X¨Ó¦n¤F¡I¥ý¸Õ¸Õ¬Ý³o¼Ë¤l¡I
  1. Sub CC()
  2. Dim arr1, arr2, arr3, arr4
  3. arr1 = Array("D:\TEST\TEST20\TT.txt", "D:\TEST\TEST20\TEST\TT.txt", "D:\TEST\TEST20\UU.csv")
  4. arr2 = Array("TT", "TT", "UU")
  5. arr3 = Array("A:B", "G:H", "C")
  6. arr4 = Array("A:B", "A:B", "A")
  7. Set fd = CreateObject("Scripting.FileSystemObject")
  8. Application.ScreenUpdating = False
  9. For I = 1 To 3
  10. Set FT = ActiveWorkbook
  11. FS = arr1(I)
  12. With Workbooks.Open(FS).Sheets(arr2(I))
  13.      FT.Sheets("Sheet2").Columns(arr3(I)) = .Columns(arr4(I)).Value
  14.     .Parent.Close False
  15. End With
  16. Next I
  17. End Sub


  18. Sub DD()
  19. Dim arr1, arr2, arr3, arr4
  20. arr1 = Array("D:\TEST\TEST20\TT.txt", "D:\TEST\TEST20\TEST\TT.txt", "D:\TEST\TEST20\UU.csv")
  21. arr2 = Array("TT", "TT", "UU")
  22. arr3 = Array("D:E", "G:H", "F")
  23. arr4 = Array("A:B", "A:B", "A")
  24. Application.ScreenUpdating = False
  25. Set FT = ActiveWorkbook
  26. For I = 1 To 3
  27. Set FT = ActiveWorkbook
  28. FS = arr1(I)
  29. With Workbooks.Open(FS).Sheets(arr2(I))
  30.      FT.Sheets("Sheet2").Columns(arr3(I)) = .Columns(arr4(I)).Value
  31.     .Parent.Close False
  32. End With
  33. Next I
  34. sheet2.[f1:f5] = [c1:c5].Value
  35.     Range("F6").FormulaR1C1 = "=""Count=""&COUNT(R[-5]C[-2]:RC[-2])"
  36.     Range("F7").FormulaR1C1 = "=""Lan""&R[-6]C[-2]&""=""&R[-6]C[-1]"
  37.     Range("F7").Copy Range("F8:F9")
  38.     Range("F6:F9").Copy
  39.     Selection.PasteSpecial Paste:=xlPasteValues
  40. End Sub
½Æ»s¥N½X
ªì¾ÇVBA¥E¨ìtwbts

TOP

¦^´_ 4# play9091


    ¦^ÂФj¤j

    ­«·s¾ã²z«á¦p¤U»¡©ú:

    Sheet1ªíA:BÄæ¶×¤JD:\TT.txt, CÄæ¶×¤JD:\UU.csv, G:HÄæ¶×¤JD:\123\TT.txt.

   §¹¦¨«á±NA:CÄæ²¾¦ÜD:FÄæ, G:HÄæ©T©w¤£°Ê
   ­×§ï«á¦A¤À§O±ND:EÄæ¦s¦ÜD:\TT.txt,FÄæ¦s¦ÜD:\UU.csv, G:HÄæ¦s¦ÜD:\123\TT.txt

  ½Ð°Ý»Pªk¦p¦ó­×§ï?
   TEST20A.rar (13.46 KB)

TOP

¦^´_ 5# luke


    ³o¼Ë¤å¦rÀɤº®e¤£¬O³£¨S§ïÅܶÜ?
¤£ª¾¹D§A¯u¥¿¥Øªº¦ó¦b?
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ luke ©ó 2012-5-14 09:47 ½s¿è

¦^´_ 6# Hsieh


    ¦^ÂÐH¶Wª©

    »¡©ú¨£ªþÀɬõ¦r³¡¤À

     ·Ð½Ð¥ý¶i ¤j¤j«ü¾É
    TEST20B.rar (17.93 KB)

TOP

        ÀR«ä¦Û¦b : ¶¢¤HµL¼Ö½ì¡A¦£¤HµL¬O«D¡C
ªð¦^¦Cªí ¤W¤@¥DÃD