title: How do i locate the variable that is the mismatch (Run-time error 13)
body: <p>I'm trying to locate the variable mismatch in this code for my coworkers VBA code. Yet i've not been able to locate the problem. The code is supposed to update 2 different sheets based on manual inputs in a 3rd sheet. This is in regard to safety hazards. </p>
  
  <p>The debug says this line of code is the one messing up</p>
  
  <pre><code> Previouscellcontentbefore = ActiveCell.Offset(rowbefore + 1, columbefore + 1)
  </code></pre>
  
  <p>The full code:</p>
  
  <pre><code>Dim I As Integer
  Dim row As Integer
  Dim before As String
  Dim after As String
  Dim cons As String
  Dim conscat As String
  Dim checks As String
  Dim check2 As String
  Dim check3 As String
  Dim rowbefore As String
  Dim columbefore As String
  Dim rowafter As String
  Dim columafter As String
  Dim checkbefore As String
  Dim checkafter As String
  Dim Previouscellcontentbefore As Integer
  Dim Previouscellcontentafter As Integer
  
  
  
  Sheets("for calculations").Visible = True
  
  cons = Application.InputBox(prompt:="Personnel; Environment; Assets; Reputation; All", Title:="Choose consequence (NB: Case sensitive)", Default:="All")
  Worksheets("For calculations").Activate
  
  Range("D37:I42").ClearContents
  Range("L37:Q42").ClearContents
  Range("C34").ClearContents
  
  Select Case cons
  
      Case "All"
          Range("C34").Value = "Risk matrix shows all types of consequences"
      Case "Personnel"
          Range("C34").Value = "Risk matrix shows all types of Personnel consequences"
      Case "Environment"
          Range("C34").Value = "Risk matrix shows Environmental consequences"
      Case "Asset"
          Range("C34").Value = "Risk matrix shows Asset consequences"
      Case "Reputation"
          Range("C34").Value = "Risk matrix shows Reputation consequences"
  End Select
  
  
  For I = 1 To 200
      Range("C47").Value = Worksheets("HAZIDS").Cells(I + 5, 2).Value
      conscat = Range("F47")
      check2 = cons Like conscat
      check3 = cons Like "All"
  
  If cons Like "All" Then
      check2 = True
  End If
  
      If check2 Then
  
  before = Range("D47")
  after = Range("E47")
  rowbefore = Mid(before, 2, 1)
  columbefore = Mid(before, 4, 1)
  rowafter = Mid(after, 2, 1)
  columafter = Mid(after, 4, 1)
  
  checkbefore = Not rowbefore Like "" And Not columbefore Like ""
  checkafter = Not rowafter Like "" And Not columafter Like ""
  
      If checkbefore Then
          Range("C36").Select
          Previouscellcontentbefore = ActiveCell.Offset(CInt(rowbefore) + 1, CInt(columbefore) + 1)
          ActiveCell.Offset(CInt(rowbefore) + 1, CInt(columbefore) + 1) = Range("C47").Value &amp; ", " &amp; Previouscellcontentbefore
  
      If checkafter Then
          Range("K36").Select
          Previouscellcontentafter = ActiveCell.Offset(CInt(rowafter) + 1, CInt(columafter) + 1)
            ActiveCell.Offset(CInt(rowafter) + 1, CInt(columafter) + 1) = Range("C47").Value &amp; ", " &amp; Previouscellcontentafter
  
          End If
      End If
  End If
  
  
  End Sub
  </code></pre>
  
  <p>I expect the macro to update sheet "Risk matrix before" and "Risk matrix after" based on the manual inputs in "HAZIDS"
  Yet the sheet "For calculations" seems to be buggy</p>