|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 按月提取数据()
arr = [a1].CurrentRegion.Value
For isheet = 1 To Worksheets.Count '清除内容
If Worksheets(isheet).Name <> "原表" Then
With Worksheets(isheet)
brr = .[a1].CurrentRegion.Value
.[a1].Resize(UBound(brr, 1), UBound(brr, 2)).Offset(1, 0).Clear
End With
End If
Next
For irow = 2 To UBound(arr, 1)
month_ = Month(arr(irow, 9))
month_str = CStr(month_) '月份提取
Set sht = Worksheets(month_str)
With sht
endrow = .[a1].End(xlDown).Row + 1
If endrow = 65537 Then
endrow = 2
End If
Cells(irow, 1).Resize(1, UBound(arr, 2)).Copy .Cells(endrow, 1)
End With
Next
End Sub
我用起来有点卡,不知道为什么 |
评分
-
1
查看全部评分
-
|