title: Referring to a specific cell in UDF
body: <p>UDF aim: Compare the value of the range with the specific cells on the same sheet. </p>
  
  <p>Error occurs <code>#Value!</code>.</p>
  
  <p>I think , that the problem in setting the pass to this cell <code>ThisWorkbook.ThisWorksheet</code>. How to do it competently?</p>
  
  <pre><code>Function Fav(Diapozon As Range) As Long
      Application.Volatile
  
      Dim n As Long
  
      For x = 1 To 4
          For y = 0 To 1
              If Diapozon.Value = ThisWorkbook.Thisworksheet.Cells(x + 29, y + 10).Value Or  _
                 Diapozon.Offset(0, 1).Value = ThisWorkbook.Thisworksheet.Cells(x + 29, y + 10).Value Then
                  n = 1
              End If
          Next y
      Next x
  
      Fav = n
  End Function
  </code></pre>