Hello.

I need help with this bit of VBA. The script executes successfully but it skips some files about 259 out of 350 are getting copied. All links have been validated and work.

Any feedback will be much appreciated.

Public Sub CopyFile()
    Dim rng As Range
    Const strNewDir As String = "D:\test\"

    For Each rng In Range("L9:L1017").SpecialCells(xlCellTypeVisible)
        If CBool(rng.Hyperlinks.Count) Then
            With rng.Hyperlinks(1)
                If CBool(InStr(.Address, Chr(92))) Then
                    FileCopy .Address, _
                      strNewDir & Replace(.Address, Chr(92), vbNullString, InStrRev(.Address, Chr(92)))
                Else
                    FileCopy .Address, _
                      strNewDir & .Address
                End If
             End With
        End If
    Next rng
    
End Sub