Hi There
I am having a problem with the below code and hoping that someone will help me here... it should update the sheet3 range A1:A5000 with the names of the photos in my photo folder and it does it but in an active sheet and active cell. how do I change this to a specific location like sheet3 range A1:A5000 so that it always update this range in this sheet even if it's not active????
Thanks for any input :-)
Here's a code:
Private Sub CommandButton7_Click()
Dim xRow As Long
Dim xDirect$, xFname$, InitialFoldr$
InitialFoldr$ = "G:\" '<<< Startup folder to begin searching from
With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = Application.DefaultFilePath & "\"
.Title = "Please select a folder to list Files from"
.InitialFileName = InitialFoldr$
.Show
If .SelectedItems.Count <> 0 Then
xDirect$ = .SelectedItems(1) & "\"
xFname$ = Dir(xDirect$, 7)
Do While xFname$ <> ""
ActiveCell.Offset(xRow) = xFname$
xRow = xRow + 1
xFname$ = Dir
Loop
End If
End With
End Sub
Bookmarks