title: VBA type mismatch when code runs and cell is empty or has no value
body: <p>I have the following IF Statement:</p>
  
  <pre><code>If Cells(i, 4).NumberFormat &lt;&gt; "0.0%" Or IsEmpty(Cells(i, 4)) Or Cells(i, 4).Value2 = "" Then
      Cells(i, 4).NumberFormat = "0.0%"
      Cells(i, 4).Value = Cells(i, 4).Value / 100
  'Else
      'Cells(i, 4).Value = Cells(i, 4).Value
      'Cells(i, 4).Value = Cells(i, 4).Value
  End If
  </code></pre>
  
  <p>When I launch the code, it runs for every cell that has data in it but,</p>
  
  <p>if the cell is empty it does not run and gives me an error saying "Type Mismatch"</p>
  
  <hr>
  
  <p>Here is the whole code:</p>
  
  <pre><code>Public Sub SortMyData()
  
  Dim i As Integer
  Dim N_Values As Integer
  
  N_Values = Cells(Rows.Count, 2).End(xlUp).Row
  
  For i = 6 To N_Values
      'Cells(i, 3).NumberFormat = "0"
  
      If Cells(i, 2).NumberFormat &lt;&gt; "0.0%" Then
          Cells(i, 2).NumberFormat = "0.0%"
          Cells(i, 2).Value = Cells(i, 2).Value / 100
      'Else
          'Cells(i, 2).Value = Cells(i, 2).Value
          'Cells(i, 3).Value = Cells(i, 3).Value
      End If
  
          If (Cells(i, 3).Value) &gt; 1000000 Then
             Cells(i, 3).Value = Cells(i, 3).Value / 1000000 &amp; "Mb"
             Cells(i, 3).HorizontalAlignment = xlRight
  
              ElseIf (Cells(i, 3).Value) &gt; 1000 Then
                  Cells(i, 3).Value = Cells(i, 3).Value / 1000 &amp; "kb"
                  Cells(i, 3).HorizontalAlignment = xlRight
  
              ElseIf Cells(i, 3).Value = Null Or Cells(i, 3).Text = Null Or Cells(i, 3).Value = "" Or Cells(i, 3).Text = "" Then
                  Cells(i, 3).Value = 0
                  Cells(i, 3).HorizontalAlignment = xlRight
          End If
  
              If Cells(i, 4).NumberFormat &lt;&gt; "0.0%" Or IsEmpty(Cells(i, 4)) Or Cells(i, 4).Value2 = "" Then
                  Cells(i, 4).NumberFormat = "0.0%"
                  Cells(i, 4).Value = Cells(i, 4).Value / 100
              'Else
                  'Cells(i, 4).Value = Cells(i, 4).Value
                  'Cells(i, 4).Value = Cells(i, 4).Value
              End If
  Next i
  
  End Sub
  </code></pre>