title: Use a cell value in VBA function with a variable
body: <p>I'm new to <code>VBA</code> and I can't manage to do what I want although it's very simple.</p>
  
  <p>I need to automatically modify cells of a big (333x333) empty (full of zeros) spreadsheet.</p>
  
  <p>In a separate spreadsheet I have the row and column of all the cells to modify. (5000 of them)</p>
  
  <p>A <code>for</code> loop seems to be suited for this purpose.</p>
  
  <p>Here is the code of my macro. The problem appears on the line before the last one.</p>
  
  <pre><code>Dim val1 As String, val2 As String, i As Integer
  
  For i = 1 To 333
  
    Sheets("Feuil2").Activate
    ActiveSheet.Cells(i, 1).Select
  
      val1 = Cells(i, 1).Value
      val2 = Cells(i, 2).Value
  
  Sheets("Classeur2.csv").Select
  Cells(val1, val2).Select
  
  ActiveCell.FormulaR1C1 = "1"
  
  Next i
  </code></pre>
  
  <p>The line that causes a problem is this one : Cells(val1, val2).Select</p>
  
  <p>I believe my error is a syntax error. But I can't find out what I should add before, after or around my two variables "val1" and "val2"</p>
  
  <p>What do you think ? </p>
  
  <p>Thanks a lot for your help.
  Nicolas.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>My problem is now solved :</p>
  
  <p>The first answer is exactly what I needed to male my macro work.
  The second answer is the proper and faster way to do it.</p>