返回列表 上一主題 發帖

[發問] 請問如何指定時間區間的工作簿,合併為同一張工作表呢?!

回復 1# lin0902

提供參考
Sub ex()
Dim file$, fn$, wb As Workbook
Application.ScreenUpdating = False
r = 1
file = Dir(ThisWorkbook.Path & "\*.xls*")
Do While file <> ""
   If Split(file, ".")(0) >= Format(Date, "mmdd") & "0700" And Split(file, ".")(0) <= Format(Date, "mmdd") & "1500" Then
      fn = ThisWorkbook.Path & "\" & file
      Set wb = GetObject(fn)
'---------------這一段要做什麼請自行修改--------
      'Set sht = wb.Worksheets(1)
      'arr = sht.[a1].CurrentRegion
      'Cells(r, "a") = arr
'-------------------------------------------------
      wb.Close False
   End If
   r = r + 1
   file = Dir
Loop
Application.ScreenUpdating = True
End Sub

TOP

        靜思自在 : 甘願做、歡喜受。
返回列表 上一主題