|
本帖最后由 zhuqing1992716 于 2018-9-28 19:42 编辑
求教各位大神,VBA如何只复制数值不复制公式。附如下:
Sub 月报表()
Application.ScreenUpdating = False
dt1 = CDate([a1])
dt2 = CDate([e1])
Set Rng = Nothing
With Sheets(11)
r = .Cells(Rows.Count, 2).End(3).Row
arr = .[a1].Resize(r, 2)
For j = 4 To UBound(arr)
If CDate(arr(j, 2)) >= dt1 And CDate(arr(j, 2)) <= dt2 Then
If Rng Is Nothing Then
Set Rng = .Cells(j, 1).Resize(1, 30)
Else
Set Rng = Union(Rng, .Cells(j, 1).Resize(1, 30))
End If
End If
Next j
End With
If Not Rng Is Nothing Then Rng.EntireRow.Copy [a4]
Application.ScreenUpdating = True
End Sub
|
|