|
こんにちは。
もうすでに回答もでているようですが。
Sheet1とSheet2をチェックし、Sheet3に書き出し。
その後、Sheet3をチェック、B列(Sheet1の金額)とC列(Sheet2の金額)
が違ったら、色塗り。
Sub ひとつのシートにまとめて処理()
Dim i As Integer, j As Integer
Dim wS1 As Worksheet, wS2 As Worksheet, wS3 As Worksheet
Dim firVal As Integer, secVal As Integer
Set wS1 = Worksheets("Sheet1")
Set wS2 = Worksheets("Sheet2")
Set wS3 = Worksheets("Sheet3")
For i = 1 To 100
firVal = wS1.Range("A" & i).Value
secVal = wS1.Range("B" & i).Value
If firVal <> 0 Then
wS3.Cells(firVal, 1).Value = firVal
wS3.Cells(firVal, 2).Value = secVal
End If
firVal = wS2.Range("A" & i).Value
secVal = wS2.Range("B" & i).Value
If firVal <> 0 Then
wS3.Cells(firVal, 1).Value = firVal
wS3.Cells(firVal, 3).Value = secVal
End If
Next i
For i = 1 To 100
If wS3.Range("B" & i).Value <> wS3.Range("C" & i).Value Then wS3.Rows(i).Interior.ColorIndex = 6
Next
End Sub
|
|