title: IF Statement with Loop in VBA
body: <p>I have a quick question. I am new to VBA and I have been stuck with how I should implement an IF statement with a Loop.</p>
  <p>I have a range that I wish to select the cell when my input box returns a certain value. For example:</p>
  <pre><code>Sub Example()
  Dim userinput As String
  userinput = InputBox(&quot;What ID would you like to choose?&quot;)
  If userinput = &quot;1&quot; Then
  
  
  
  End If
  End Sub
  </code></pre>
  <p><strong>If userinput equals &quot;1&quot; then I want Range(&quot;A10&quot;) to be selected</strong>. However, in my sheet, userinput value can be from 1-50 and I don't want to write 49 elseif statements. How can I loop through the range of A10:A86 to return the correct range depending on the userinput?</p>
  <p>Thanks</p>