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

[µo°Ý] excel ¦Û°Ê¿z¿ï¨Ì·Ó¥t¥~¤@­Ó¤u§@ªíªº¤º®e

¦^´_ 1# ljuber
¸Õ¸Õ¬Ý¡G
  1. Option Explicit

  2. Sub Ex()
  3.     Dim loc As Long, cts As Long, txtFile As String, arr() As String, sp() As String
  4.    
  5.     Application.DisplayAlerts = False
  6.     Application.ScreenUpdating = False
  7.    
  8.     txtFile = Application.GetOpenFilename("(*.txt), *.txt")
  9.     If txtFile = "" Then Exit Sub
  10.    
  11.     sp = Split(txtFile, "\")
  12.     With Workbooks("½m²ß.xlsm")
  13.         cts = .Sheets("³]©w").Range("A1").End(xlDown).Row
  14.         
  15.         ReDim Preserve arr(cts - 1)       '  °ÊºA¦a³B²z arr °}¦C±a¤J¤§°}¦C­È¡C
  16.         For loc = 2 To cts
  17.            arr(loc - 1) = .Sheets("³]©w").Range("A" & loc).Text   '
  18.         Next loc
  19.         
  20.         loc = .Sheets("¸ê®Æ").Range("A1").End(xlDown).Row
  21.         '  Workbooks.OpenText Filename:=ThisWorkbook.Path & "\10412-ai201.txt", Origin:=950, Tab:=True, TrailingMinusNumbers:=True
  22.         Workbooks.OpenText Filename:=txtFile, Origin:=950, Tab:=True, TrailingMinusNumbers:=True
  23.       
  24.         ActiveSheet.Range("A:G").AutoFilter Field:=5, _
  25.             Criteria1:=arr, Operator:=xlFilterValues
  26.             '  °ÊºA¦a³B²z Criteria1 ±a¤J¤§­È¡C
  27.             '  Criteria1:=Array("11001", "11005", "11009"), Operator:=xlFilterValues
  28.         Columns("A:G").Copy
  29.         .Sheets("¸ê®Æ").Range("A" & loc + 1).PasteSpecial Paste:=xlPasteValues
  30.         
  31.         '  Workbooks("10412-ai201.txt").Close
  32.         Workbooks(sp(UBound(sp))).Close
  33.         '  .Sheets("¸ê®Æ").Range("A" & loc + 1).Select
  34.     End With
  35. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ­n§åµû§O¤H®É¡A¥ý·Q·Q¦Û¤v¬O§_§¹¬üµL¯Ê¡C
ªð¦^¦Cªí ¤W¤@¥DÃD