Sub prcSplitFilePath()
Dim wst As Worksheet
Dim lngLastRow As Long
Dim lngRow As Long
Dim strFullPath As String
Dim strFolderPath As String
Dim strFileName As String
Set wst = ThisWorkbook.Sheets("ファイルリスト")
lngLastRow = wst.Cells(wst.Rows.Count, "A").End(xlUp).Row
For lngRow = 1 To lngLastRow
strFullPath = wst.Cells(lngRow, 1).Value
strFolderPath = Left(strFullPath, InStrRev(strFullPath, "¥"))
strFileName = Mid(strFullPath, InStrRev(strFullPath, "¥") + 1)
wst.Cells(lngRow, 2).Value = strFolderPath
wst.Cells(lngRow, 3).Value = strFileName
Next lngRow
End Sub
コメント