|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
我把日期先转换成标准的日期格式再查找日期的位置。- Sub ykcbf() '//2024.7.18
- b = [{6,12}]
- With Sheets("0数据录入")
- rq = CDate(Replace(.[s6], ".", "/"))
- arr = .[s1:y100]
- End With
- With Sheets("2水量表格统计")
- r = 34
- For i = 4 To r
- If CDate(Replace(.Cells(i, 1), ".", "/")) = rq Then
- For j = 2 To 7
- .Cells(i, j) = arr(b(1), j)
- Next
- End If
- Next
- End With
- With Sheets("4电量统计")
- r = 35
- For i = 5 To r
- If CDate(Replace(.Cells(i, 1), ".", "/")) = rq Then
- For j = 2 To 6
- .Cells(i, j) = arr(b(2), j)
- Next
- End If
- Next
- End With
- MsgBox "OK!"
- End Sub
复制代码
|
|