title: Sum specific values in Excel and display in Message Box?
body: <p>I have an Excel which has all list of marks in C Column.
  I need a message box which should calculate sum of those marks and should display me while closing Excel (or) it's ok if it shows me when I click any shortcut key.
  I have tried using below code but it does not work:</p>
  
  <pre><code> Private Sub Workbook_BeforeClose(Cancel As Boolean)
      Dim answer As Integer
      answer = MsgBox("Do want to see the total?", vbYesNo + vbQuestion, "Total")
  
          If answer = vbYes Then
            Range("G1").Value = Application.Sum(Range(Cells(3, 2), Cells(3, 3000)))
      Else
          'do nothing
      End If
      End Sub
  </code></pre>