當前位置:成語大全網 - 新華字典 - VBA多條件查詢問題

VBA多條件查詢問題

推薦使用VBA,公式太繁瑣,而且計算慢

Public Sub 查詢(sh1 As Worksheet, sh0 As Worksheet)

'sh1 數據源, sh0 結果,當前工作表

Dim Rng1T As Range, Rng1C As Range, Rng0 As Range, RngTj As Range

Dim r1E&, r0S&, r0E&

Dim iKeys, iItems

Dim d1T, d1C, dTj, d0P

Dim Arr1, Arr0, Arr1T, Arr0Tj, ArrJg

Dim rs As New Collection

Dim c As Range, hg, sAll$, iStr$, n&, r, col%, cols%, i, j, tmp, t As Boolean, iTimer

iTimer = Timer

sAll = "全部" '取消條件 的字符

iStr = "<>=≤≥<>=≠" '可能出現在條件中的首字符

Set Rng1T = sh1.Range("A3:L3") '數據源,只要表頭就行

Set Rng1C = sh1.Range("B3:F3") '數據源,要復制的列,表頭

Set Rng0 = sh0.Range("B4") '結果,開始放置的位置

Set RngTj = sh0.Range("B1:F2") '判斷條件

r1E = Rng1T.End(xlDown).Row

r0S = Rng0.Row

…………

…………

詳細Hi我,直接傳文件