title: Macro to Record Changes to Range of cells in separate log sheet
body: <p>I've got a macro that creates a log, in a log sheet every time there a cell changed in a specific worksheet.</p>
  
  <p>That macro works really well but unfortunately a little too well!! Because every time I delete a row or a column it makes a record of every cell in that row or column that has been deleted!! (That's lots of cells!! So the spreadsheet just falls over)</p>
  
  <p>Is there a way to make my macro only record that a row has been deleted (rather than every cell in that row? If not... can I just get it to ignore creating a log file if a row or column is deleted?</p>
  
  <p>Or can I limit the code to a particular range. Eg. If I delete a row it only logs that cells A13:BC13 have been deleted</p>
  
  <p>My code that I have used so far is a follows:</p>
  
  <pre><code>Const intUsernameColumn = 1
  Const intCellRefColumn = 2
  Const intNewValueColumn = 3
  Const intTimestampColumn = 4
  
  Private Sub Worksheet_Change(ByVal Target As Range)
  
    Dim shtLog As Worksheet
    Dim cll As Variant
    Dim lngNextRow As Long
  
    Set shtLog = ThisWorkbook.Sheets("Log")
  
    For Each cll In Target.Cells
      lngNextRow = shtLog.Cells.Find(What:="*", After:=[A1], Searchorder:=xlByRows, _
                                     SearchDirection:=xlPrevious).Row + 1
      shtLog.Cells(lngNextRow, intUsernameColumn).Value = Environ("username")
      shtLog.Cells(lngNextRow, intCellRefColumn).Value = cll.Address
      shtLog.Cells(lngNextRow, intNewValueColumn).Value = cll.Value
      shtLog.Cells(lngNextRow, intTimestampColumn).Value = Format(Now, "dd-mmm-yy hh:mm:ss")
    Next cll
  End Sub
  </code></pre>
  
  <p>I'm still fairly new at this so any help would be appreciated</p>
  
  <p>Thanks!!</p>