0

ワークシートで連続する一連の行セルを検索する

    h1 h2 h3 h4 h5             h1 h2 h3 h4 h5
    1  2  3  6  7              1  2  3  8  9
    2  2  2  4  5              3  3  3  2  1
    table 1                    table 2

テーブル 1 の table2 の各行の最初の 3 つのセルを検索するループをコーディングするにはどうすればよいですか? テーブルの形式が同じであることを前提としています。

範囲とセルは、カウンターを使用できないため、機能していないようです

4

1 に答える 1

0
Dim tlb1 as range,tbl2 as range
dim rw1 as range, rw2 as range

set tbl1=Range("your table1 range here")
set tbl2=Range("your table2 range here")

for each rw1 in tbl1.rows
    for each rw2 in tbl2.rows
        if rw1.cells(1)=rw2.cells(1) and rw1.cells(2)=rw2.cells(2) _
           and rw1.cells(3)=rw2.cells(3) then
           'do whatever you want to do on match...
           'Exit For 'if you want to stop when you find the first match...
        end if
    next rw2
next rw1
于 2013-07-25T20:35:15.177 に答える