title: Invalid or unqualified reference error using .Cells
body: <p>I'm trying to create excel template (the volume of data will be different from case to case) and it looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/RkN1v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RkN1v.png" alt="enter image description here"></a></p>
  
  <p>In every even row is "Customer" and I would like to put in every odd row "Ledger". Basically it should put "Ledger" to every odd row until there are data in column C. I have this code:</p>
  
  <pre><code>'========================================================================
  ' INSERTING LEDGERS for every odd row (below Customer)
  '========================================================================
  
  Sub Ledgers()
  
      Dim rng As Range
      Dim r As Range
      Dim LastRow As Long
  
      LastRow = .Cells(.Rows.Count, "C").End(xlUp).Row
      Set rng = .Range("C5:C" &amp; LastRow)
  
      For i = 1 To rng.Rows.Count
          Set r = rng.Cells(i, -2)
          If i Mod 2 = 1 Then
              r.Value = "Ledger"
          End If
  
      Next i
  
  End Sub
  </code></pre>
  
  <p>But it gives me an error msg <strong>Invalid or unqualified reference</strong>. Could you advise me, where I have the error, please?</p>
  
  <p>Many thanks!</p>