使用fornext將n個條件用&連接為1個條件,提高查找速度。
- 文化問答
- 答案列表
excel vba多條件查找:vba多條件查找公式[朗讀]
為什麼非要用vba呢用條件格式不就可以了嗎?例如l1,新建規則,選擇使用公式設置單元格格式,公式=countif(l:l,l1)>1,設置好符合條件的填充色l:l根據實際情況選擇範圍就可以了?
submacro1()dimxrngasrange,firstrngasrangeifleft(range("a1"),3)="d1["thensetfirstrng=range("a1")elsesetfirstrng=cells.find("d1[")endifsetxrng=cells.find("d1[",firstrng)ifxrngisnothingthenmsgbox"沒有了"elsemsgboxxrng.rowendifendsub。
subaddrows()dimcasintegerforc=1to4activesheet.rows(6).insertshift:=xldownnextendsub。
在e1起輸出結果subtest()setd=createobject("scripting.dictionary")r=range("a65536").end(xlup).rowarr=range("a1:c"&r)fori=1torifarr(i,1)="。