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

[µo°Ý] ½Ð±ÐEXCEL¦X¨Ö

¦^´_ 1# twcg
  1. Sub Ex()
  2.     Dim MergePath As String, FS As Object, MergeWorkbook As Workbook, E
  3.     MergePath = "D:\test\"  '¦X¨ÖÀɮתº¸ê®Æ§¨
  4.     Set FS = CreateObject("Scripting.FileSystemObject").GETFOLDER(MergePath).Files
  5.     'FS=¦X¨ÖÀɮ׸ê®Æ§¨¤¤©Ò¦³Àɮת«¥óªº¶°¦X
  6.     Set MergeWorkbook = Workbooks.Add(xlWBATWorksheet)  '·s¶}ªºÀÉ®×
  7.     Application.ScreenUpdating = False
  8.     For Each E In FS
  9.         If E Like "*.xls" Then  'ÀÉ®× ªº°ÆÀɦW¬°xls
  10.             With Workbooks.Open(E)
  11.                 .Sheets(1).Copy MergeWorkbook.Sheets(1)  '±N¤u§@ªí ½Æ»s¨ì·s¶}ªºÀɮפ¤
  12.                 .Close
  13.             End With
  14.         End If
  15.     Next
  16.     Application.DisplayAlerts = False
  17.     MergeWorkbook.SaveAs MergePath & "¦X¨Ö.XLS"  '¦X¨ÖÀɦsÀÉ
  18.     Application.DisplayAlerts = True
  19.     Application.ScreenUpdating = True
  20. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ÀR§¤±`®¦¤v¹L¡B¶¢½Í²ö½×¤H«D¡C
ªð¦^¦Cªí ¤W¤@¥DÃD