|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub 获取指定时期的内容()
- Dim Ipath, Ifile As String, N, mydate As Date, brr
- Application.ScreenUpdating = False
- Sheet1.Cells.ClearContents
- mydate = InputBox("录入正确的时间格式,例如2015-2-1", "输入", Default)
- Ipath = ThisWorkbook.Path & ""
- Ifile = Dir(Ipath & "*.dbf")
- If Ifile <> "" Then
- Do
- wjdate = Format(FileDateTime(Ipath & Ifile), "yyyy-mm-dd") ''文件的修改时间
- lrdate = Format(mydate, "yyyy-mm-dd") '''''录入的时间
- myname = Left(Ifile, 5)
- If wjdate = lrdate And myname = "barup" And InStr(Ifile, "QZ") Then ' 判断
- Set wb = Workbooks.Open(Ipath & Ifile)
- wbsht = wb.ActiveSheet.Name
- brr = wb.Sheets(wbsht).UsedRange
- N = N + 1
- wb.Close
- Sheet1.Range("A" & Cells(Rows.Count, 1).End(xlUp).Row + 1).Resize(UBound(brr), UBound(brr, 2)) = brr
- End If
- Ifile = Dir
- Loop While Ifile <> ""
- Application.ScreenUpdating = True
- End If
- MsgBox "完成", 0 + 64, "提示"
- End Sub
复制代码 没有优化标题,,,大概是这样。不知道对不对。。。你试一下。写得比较啰嗦。呵呵 |
评分
-
1
查看全部评分
-
|