title: VBA Rows Property Variables
body: <p>I'm trying to unhide a range of rows.  This is to be done within a loop, so I'm using variables; here's the code:</p>
  
  <pre><code>For i = 2 To lastrow
  If Workbooks("Discrepancies1").Worksheets(1).Cells(i, 8) = "USRFLG02=T" Then
  a = Workbooks("Discrepancies1").Worksheets(1).Cells(i, 46).Value
  b = Application.WorksheetFunction.CountIf(c, a)
  
  Workbooks("Discrepancies1").Worksheets(1).Rows("i: i + b - 1").Hidden = False
  
  End If
  Next
  End If
  </code></pre>
  
  <p>However, running this gives me a type mismatch error on the last line of code.  I've checked all the variables, and they are what they should be.  It seems like VBA doesn't like the colon (denoting range) in conjunction with variables.  I can run this without variables, or without the range, but I can't have both.  Suggestions?</p>