title: Method 'Cells' of Object'_Global' failed VBA
body: <p>EDIT: i have an access application in which i need to open an existing excel sheet, find a date (already in the sheet) and populate a row (with the date cell column) with either 1 or 0</p>
  
  <p>this means i have to convert the datecell.column to the alphabet equivalent before i can set a cell to be populated. </p>
  
  <p>I used a function, which i have used in excel before (as seen below)  END EDIT</p>
  
  <pre><code>Function Col_Letter(lngcol) As String
      Dim vArr
      vArr = Split(Cells(1, lngcol).Address(True, False), "$")
      Col_Letter = vArr(0)
      End Function
  </code></pre>
  
  <p>the code below is an example of how i use the code in my application</p>
  
  <pre><code>Dim  CD, d, f, f1, f2, g, strd
    ...
              For n = 0 To 10
              d = CD + n
              strd = Str(d)
              Select Case Weekday(strd)
              Case vbSunday, vbSaturday
  
              Case Else
              Set f = book.Worksheets(a).Range("5:5").Find(strd)
              f1 = f.Column
              f2 = Col_Letter(f1)
              g = f2 &amp; Srow
              book.Worksheets(a).Range(g).Value = "0"
              End Select
              Next n
          End If
  'CD = Current date, a = worksheetname set eariler in code, srow = excel row number set earlier in code`enter code here`
  'this is executed in an excel sheet which was opened from access
  </code></pre>
  
  <p>when i run this, sometimes it runs perfectly and other times i get the Method 'Cells' of Object'_Global' failed error code and when i click debug it highlights the third line of the col_letter function <br></p>
  
  <pre><code>vArr = Split(Cells(1, lngcol).Address(True, False), "$")
  </code></pre>
  
  <p>do you have a clue to why it (seemingly) randomly chooses to display this error?</p>