Private Sub AllFolderFiles()
Dim wb As Workbook
Dim TheFile As String
Dim MyPath As String
MyPath = GetFolder
ChDrive Left(MyPath, Application.WorksheetFunction.Search(":", MyPath))
ChDir MyPath
TheFile = Dir("*.xls")
On Error Resume Next
Do While TheFile <> ""
Application.ScreenUpdating = False
Set wb = Workbooks.Open(MyPath & "\" & TheFile)
wb.Activate
For i = 1 To Cells(Rows.Count, "h").End(xlUp).Row
If Cells(i, "H") = "Cube" Then
Cells(i, "k") = "Van"
End If
Next i
wb.Close
Application.ScreenUpdating = True
TheFile = Dir
Loop
Set wb = Nothing
End Sub
Function GetFolder(Optional strPath As String) As String
Dim fldr As FileDialog
Dim sItem As String
Set fldr = Application.FileDialog(msoFileDialogFolderPicker)
With fldr
.Title = "Select a Folder"
.AllowMultiSelect = False
.InitialFileName = strPath
If .Show <> -1 Then GoTo NextCode
sItem = .SelectedItems(1)
End With
NextCode:
GetFolder = sItem
Set fldr = Nothing
End Function