0

私は10の評判を持っていないので、画像をアップロードすることができません. com/forum/excel-questions/833202-visual-basic-applications-find-non-match-criteria-ws2-copy-criteria-ws1.html

私は2つのワークシートを持っています。「Sheet1」の従業員 ID と一致する「Sheet2」の従業員 ID を見つける必要があります。「Sheet2」に「Sheet1」にない ID がある場合、「Sheet2」の上記の行から特定のセルを「Sheet1」にコピーする必要があります。

その上、コピーするときは、前の $amounts が正しい場所にあるように、コピーされたセルに行全体が挿入されるようにする必要があります (Mr. Excel の投稿を参照)。これはおそらく意味がありません。画像アップできればいいのに…

Option Explicit

Sub CopyNonMatches()

Dim ws1 As Worksheet, ws2 As Worksheet
Dim ws1Range As Range, ws2range As Range
Dim ws1Long As Long, ws2long As Long

Set ws1 = ThisWorkbook.Sheets("Sheet1")
Set ws2 = ThisWorkbook.Sheets("Sheet2")

With ws1
ws1Long = .Range("C" & .Rows.Count).End(xlUp).Row
End With

Set ws1Range = ws1.Range("C3", "C" & ws1Long)

With ws2
ws2long = .Range("C" & .Rows.Count).End(xlUp).Row
End With

Set ws2range = ws2.Range("C3", "C" & ws2long)

'Now I need to compare the ranges 'ws1Range' with 'ws2Range' and if 'ws2Range' has ID's that...
'...are not included in 'ws1Range', then I need to copy over info from Columns A to C from the row that had no match over to 'Sheet1'.

???????????????????

End Sub
4

1 に答える 1