|
附件供参考。。。
- Sub ykcbf() '//2024.5.17
- Application.ScreenUpdating = False
- Set fso = CreateObject("Scripting.FileSystemObject")
- p = ThisWorkbook.Path & "" '//这个到时改为你自己实际的路径
- Set sh = ThisWorkbook.Sheets("Sheet1")
- rq = Date
- nf = Year(rq): yf = Month(rq)
- Select Case yf
- Case Is <= 3
- fn = nf & "年 1月-3月"
- Case Is <= 6
- fn = nf & "年 4月-6月"
- Case Is <= 9
- fn = nf & "年 7月-9月"
- Case Else
- fn = nf & "年 10月-12月"
- End Select
- p1 = p & nf & "自制扫描时间记录"
- f = p1 & fn & "自制HU扫描时间记录.xlsm"
- Set wb = Workbooks.Open(f, 0)
- With wb.Sheets("自制来货时间")
- r = .Cells(Rows.Count, 1).End(3).Row
- If r = 1 Then
- MsgBox "数据文件没有内容!"
- Exit Sub
- End If
- arr = .[a1].Resize(r, 2)
- End With
- wb.Close 0
- ReDim brr(1 To r, 1 To 1)
- For i = 2 To UBound(arr)
- If arr(i, 2) = rq Then
- m = m + 1
- brr(m, 1) = arr(i, 1)
- End If
- Next
- With sh
- .[a7:a1000] = ""
- .[a7].Resize(m, 1) = brr
- End With
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
2
查看全部评分
-
|