View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
ct60 ct60 is offline
external usenet poster
 
Posts: 26
Default Registry compare

Hi Lillian -

I think I understand the question. It is confusing because when you say
registry key I think you mean the registry in the computer. In any case, you
are basically comparing cols A and D as well as col B and E on Sheet1 and
dumping out the difference onto Sheet2. This code should work. You will
also have to fill in the number of rows you need to check. You can guess the
largest possible number of rows because blank rows will compare as the same.
Try this:

Sub ck_It()
Dim ws As Worksheet
Dim report_ws As Worksheet
Dim reportPtr As Integer
Dim i As Integer

Set ws = ThisWorkbook.Sheets("Sheet1")
Set report_ws = ThisWorkbook.Sheets("Sheet2")

reportPtr = 1

' Assume there are 100 rows to compare and that we
' are comparing col A to col D and col B to col E

With ws
For i = 1 To 100 ' or however many rows you need to check
If .Range("A" & i) < .Range("D" & i) Then
report_ws.Range("A" & reportPtr) = "Cols 'A' and 'D' not
equal on row " & i
reportPtr = reportPtr + 1
End If

If .Range("B" & i) < .Range("E" & i) Then
report_ws.Range("A" & reportPtr) = "Cols 'B' and 'E' not
equal on row " & i
reportPtr = reportPtr + 1
End If
Next
End With
End Sub

Hope that helps

Chris (ct60)


"Lillian Lian" wrote:

I have two registry key which is test.reg and test-A.reg, the test.reg is
before I install script on the machine, the test-A.reg is after I install
script on the machine, so how can I write the VB script to compare both
test.reg and rest-A.reg, right now on the sheet1 I have test.reg from column
A to B, test-A.reg from column D to E, how can I write the macro, dump the
different in sheet2.


Thank you for the help

Lillian