|
こんばんは。
こんな感じでしょうか?
Sub test()
Dim i As Long
Dim SH1 As Worksheet, SH2 As Worksheet, SH3 As Worksheet
Set SH1 = Sheets("Sheet1")
Set SH2 = Sheets("Sheet2")
Set SH3 = Sheets("Sheet3")
With SH3
.Cells.ClearContents
.Range("A1:C1").Value = Array("行", SH1.Name, SH2.Name)
End With
For i = 1 To SH1.Cells(Rows.Count, "H").End(xlUp).Row
If Not SH1.Cells(i, "H").Value = SH2.Cells(i, "H").Value Then
With SH3.Cells(Rows.Count, "A").End(xlUp).Offset(1)
.Value = i & "行目"
.Offset(, 1).Value = SH1.Cells(i, "H").Value
.Offset(, 2).Value = SH2.Cells(i, "H").Value
End With
End If
Next
End Sub
|
|