Search code examples
checksumxlsx

XLS Row-Level Checksum?


I have a large XLS file produced from an SQL database for offline review and edit. I'd like to identify/flag just the modified rows to permit the construction of the necessary SQL commands to make the necessary row-level updates back in the database.

I can currently update ALL the rows in a set (changed or not), but performance across our VPN is pretty poor, and sometimes just not feasible. It would be very helpful to consider just the flagged rows.

Any suggestions to begin to address this?

Notes:

The XLS row count can be 5K to 100K (or higher) rows depending on the export query. There are 25 columns per row; format is fixed.

No issue with VBA/Macros -

A poorman's approach is fine - this is an internal project.

Thanks!


Solution

  • I found a very workable approach.

    Simply drop this code into a new module, adjust the the result/column, and presto.

    This works with cutting/pasting across many rows:

    Private Sub Worksheet_Change(ByVal Target As Range) 
        Dim c As Range 
        Application.EnableEvents = False 
        For Each c In Target 
            If c.Column > 1 And c.Column < 18 Then 
                Cells(c.Row, 1) = Now 
            End If 
        Next c 
        Application.EnableEvents = True 
    End Sub