Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = 1 'first row of data
- n = 10 'last row of data, could be 100 for all I know
- y = 1 'first column of data
- z = 10 'last column of data, could be 100 for all I know
- Do While x <= n
- y = 1 'reset the value of y
- Do While y <= z
- If Workbooks(a).Sheets("Sheet3").cells(x, y) = Workbooks(b).Sheets("Sheet3").cells(x, y) Then
- MsgBox "Found the error in row " & x & " and column " & y & ".", VbOKOnly
- 'Do something else...
- else
- End If
- y = y + 1 'go to the next column
- Loop
- x = x + 1 'go to the next row
- Loop
- sub compareandcopy()
- dim source as worksheet
- dim target as worksheet
- set source = workbooks("nameoftemplate").worksheets(3)
- set target = workbooks("my wip file").worksheets(3)
- dim x as integer
- dim y as integer
- dim i as integer
- source.Activate
- x = Selection.Row
- target.Activate
- y = Selection.Row
- for i = 1 to 99
- if source.cells(x,i)<>target.cells(y,i) then
- target.rows(y+1).insert
- source.rows(x).copy target.cells(y+1,1)
- exit for
- end if
- next i
- end sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement