VBA,从无格式的表中提取文件名

我有一张表格,里面装满了我想提取的文件。 它们存在于A:D列中,但分散在整个表格中。 在其他文本之间也有空行。 (这是一堆代码)。 有没有人有任何提取这些文件名称的策略? 逐行是单调乏味的,由于空白,过滤不起作用,但每个文件名通常以“/ home”开头。

正如这里所解释的,你可以在循环中使用.Find来迭代包含某个特定types值的单元格:

 Sub ExtractFileNames() Application.ScreenUpdating = False Dim R As Range, c As Range, copyTo As Range Dim startCell As String Set copyTo = Sheets(2).Range("A1") Set R = Intersect(Sheets(1).UsedRange, Sheets(1).Range("A:D")) Set c = R.Find("*/*.*") If Not c Is Nothing Then startCell = c.Address Do copyTo.Value = c.Value Set copyTo = copyTo.Offset(1) Set c = R.FindNext(c) Loop Until c Is Nothing Or c.Address = startCell End If Application.ScreenUpdating = True End Sub