title: For loop: skip value when error occurs
body: <p>I have a table on Sheet3 and a reference list on Sheet2 which refers to the table data on Sheet3, references on Sheet2 are in a different order to the references in the table on Sheet3. I am currently using the VLOOKUP command to search for the corresponding reference on Sheet3 and populate the column on Sheet2, the list is long therefore I used a for loop which goes through all the rows and applies the VLOOKUP command as shown:
  Dim Y As Integer</p>
  
  <pre><code>Y = 2
  For Y = 1 To 108
  Worksheets(2).Range("C" &amp; Y).Value = Application.WorksheetFunction.VLookup(ActiveWorkbook.Sheets(2).Range("A" &amp; Y), ActiveWorkbook.Sheets(3).Range("A2:B113"), 2, False)
  Next Y
  </code></pre>
  
  <p>Note: I understand having everything on 1 line is messy and I should really be using variables but this way it is easier for me to read the statements as I have lots of them which are similar on 1 page.</p>
  
  <p>Now my problem is that some of the reference numbers shown on Sheet1 are missing on Sheet2 and for these reference numbers I get an error and debug popup for my VLOOKUP statement therefore, is there any way that I could go through the loop as normal but once encountering these missing values just skip them and go onto the next ones? I mean something like if an error occurs skip Y?</p>