title: VBA Userform data change check
body: <p>I am using a userform to update data in a worksheet, I have an update command button to copy the data from the 'data' worksheet to the 'archive' and replace in the 'data' worksheet (essentially the 'archive' is a log of all previous lines and the 'data' is the most recent information)</p>
  
  <p>The information is changed in text boxes and combo boxes</p>
  
  <p>What Im struggling with is for the 'update' cmdbutton to first check if any changes where made before copying the data, if not I want a msg box to read 'no change in data, please close form' </p>
  
  <p>Here is the code for the userform so far:</p>
  
  <pre><code>Private Sub cmdUpdate_Click()
  ' To write edited info of userform2 to Sheets("Data")
  Dim LastRow As Long
  Dim ABnum As Double
  Dim ABrng As Range
  Dim WriteRow As Long
  
  'error statement
  On Error GoTo errHandler:
  'hold in memory and stop screen flicker
  Application.ScreenUpdating = False
  ' Make sure we're on the right sheet
  With Sheets("Data")
  ' Get the last row used so can set up the search range
      LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
  ' Set the range to search for the AB number
      Set ABrng = .Range("A1:A" &amp; LastRow)
  ' Get the AB number from what is selected on userform2
      ABnum = txtup1.Value
  ' Get the row of sheet for this AB number
      WriteRow = Application.Match(ABnum, ABrng, 0)
  ' Make this AB number the active cell
      With .Cells(WriteRow, 1)
  ' Write in all the editable options
      Sheets("Archive").Range("A" &amp; Rows.Count).End(xlUp)(2).Resize(, 14).Value = .Resize(, 14).Value
          .Offset(0, 4) = cboup3.Value
          .Offset(0, 5) = cboup4.Value
          .Offset(0, 6) = cboup5.Value
          .Offset(0, 7) = cboup6.Value
          .Offset(0, 8) = Date
          .Offset(0, 9) = txtrev.Value
          .Offset(0, 12) = txtup9.Value
          .Offset(0, 13) = txtup8.Value
      End With
  End With
  ' Filter the Data
  FilterMe
  ' Close the form
  Unload Me
  
  MsgBox ("Enquiry E0" + Me.txtup1.Text + " has been updated")
  
  errHandler:
  'Protect all sheets if error occurs
  'Protect_All
  'show error information in a messagebox
  If Err.Number &lt;&gt; 0 Then
      MsgBox "Error " &amp; Err.Number &amp; " just occured."
  End If
  
  End Sub
  </code></pre>