|
各位大神如何将这段代码变为一个过程?????????
Sub 提取数据()
Dim 开始日期 As Date
Dim 结束日期 As Date
Dim 采油井 As String
Dim arr
Dim brr
Dim D As Long
arr = Sheet1.Range("a1").CurrentRegion
Hmax = UBound(arr)
D = Range("l2") - Range("k2") + 1
ReDim brr(1 To D, 1 To 7)
For i = 1 To Hmax
If arr(i, 1) = Range("j2") Then
If arr(i, 2) >= Range("k2") And arr(i, 2) <= Range("l2") Then
n = n + 1
brr(n, 1) = arr(i, 1)
brr(n, 2) = arr(i, 2)
brr(n, 3) = arr(i, 3)
brr(n, 4) = arr(i, 4)
brr(n, 5) = arr(i, 5)
brr(n, 6) = arr(i, 6)
brr(n, 7) = arr(i, 7)
End If
End If
Next
Sheet1.Range("j6").Resize(D, 7) = brr
Sheet1.Range("j5:p5") = Array("井号", "日期", "生产时间", "产液", "含水", "产油", "备注")
End Sub
如何将以上代码变成VBA过程?????
|
|