title: Cell value = lastmodifieddate from hyperlink path
body: <p>Difficult to explain but my picture will make it clear.</p>
  
  <p>My Excel sheet has hyperlinks in column a that links to the file for opening
  but how to get the lastmodifieddate from that file in column l </p>
  
  <p>Example : a22 is linked to file vimco, so what is the last modifieddate from that file has to come in l22</p>
  
  <p><a href="https://i.stack.imgur.com/Msmo3.jpg" rel="nofollow noreferrer">the picture here</a></p>
  
  <blockquote>
    <p>also not all rows in column a has hyperlinks and contains also a empty
    or not linked cell so if that is so than nothing has to show in column
    l it has to be blank if a is blank or not linked</p>
    
    <p>can it make a formula? so i type in cell =moddate and then shows the
    date
    is ok now</p>
  </blockquote>
  
  <p>ok got the code now</p>
  
  <pre><code>Function GetDateTime(myCell As Range) As Date
      Dim myHyperlink As Hyperlink
      Dim Filename As String
      Application.Volatile
      On Error Resume Next
          Set myHyperlink = myCell.Hyperlinks(1)
      On Error GoTo 0
      If Not myHyperlink Is Nothing Then
          Filename = myHyperlink.Address
              'If it is a relative address insert this workbook's path
          If Not (Filename Like "\\*" Or Filename Like "[A-Z]:\*") Then
              Filename = ThisWorkbook.path &amp; "\" &amp; Filename
          End If
          If Dir(Filename, vbNormal) &lt;&gt; "" Then
              GetDateTime = FileDateTime(Filename)
          Else
              GetDateTime = ""
          End If
      Else
          GetDateTime = ""
      End If
  End Function
  </code></pre>
  
  <p>but now second thing if the link changes or I open my workbook or swap sheets is not updating the value of getdatetime - can that be fixed?</p>