|
Sub 提取大单数据()
Dim wb As Workbook
Set wb = GetObject("D:\数据管理与运营支持\基础数据\业务数据\寿险银邮\寿险银邮渠道业绩数据(20180701-0731)-20180820.xlsm")
Dim png, address1, p, qng, address2, q, nng, address3, n, sng, address4, s, rng, address5, r
Set png = wb.Sheets("基础数据").UsedRange.Find(What:="险种", lookat:=xlWhole)
address1 = png.Address(0, 0)
p = wb.Sheets("基础数据").Range(address1).Column
Set qng = wb.Sheets("基础数据").UsedRange.Find(What:="二级机构", lookat:=xlWhole)
address2 = qng.Address(0, 0)
q = wb.Sheets("基础数据").Range(address2).Column
Set nng = wb.Sheets("基础数据").UsedRange.Find(What:="银行总行", lookat:=xlWhole)
address3 = nng.Address(0, 0)
n = wb.Sheets("基础数据").Range(address3).Column
Set sng = wb.Sheets("基础数据").UsedRange.Find(What:="十大渠道", lookat:=xlWhole)
address4 = sng.Address(0, 0)
s = wb.Sheets("基础数据").Range(address4).Column
Set rng = wb.Sheets("基础数据").UsedRange.Find(What:="新约保费", lookat:=xlWhole)
address5 = rng.Address(0, 0)
r = wb.Sheets("基础数据").Range(address5).Column
ar = wb.Sheets("基础数据").[a1].CurrentRegion: m = 1
For i = 2 To UBound(ar)
If ar(i, p) = Sheet1.Cells(12, 1) And Application.WorksheetFunction.CountIf(ThisWorkbook.Sheets("参数").Range(Cells(7, 2), Cells(12, 2)), ar(i, q)) > 0 Then
'Or ar(i, a) = Sheet1.Cells(12, 2) Or ar(i, a) = Sheet1.Cells(10, 3) Or ar(i, a) = Sheet1.Cells(11, 3) _
'Or ar(i, a) = Sheet1.Cells(12, 3)) And ar(i, b) >= Sheet1.Cells(13, 1))
m = m + 1
For j = 1 To UBound(ar, 2)
ar(m, j) = ar(i, j)
Next
End If
Next
Sheet5.Cells.Clear
Sheet5.Cells.NumberFormatLocal = "@"
Sheet5.Range("A1").Resize(m, UBound(ar, 2)) = ar
Sheet5.Name = "首年奖励核算"
End Sub
问题应该是出在"Application.WorksheetFunction.CountIf(ThisWorkbook.Sheets("参数").Range(Cells(7, 2), Cells(12, 2)), ar(i, q)) > 0" 请求帮忙。
|
评分
-
1
查看全部评分
-
|