I would like to have some help with regards to how to place properly declare a global variable (i think?) and then use that variable in subsequent Sub.
Here is the code I have so far. I allows user to select a file using a browser window and then the second sub should write the filepath into the cell.value.
Thanks
Here is the code I have so far. I allows user to select a file using a browser window and then the second sub should write the filepath into the cell.value.
HTML:
Sub BrowseFile()
Dim Action As Variant
Dim FileName As String
With Application.FileDialog(msoFileDialogFilePicker)
.InitialFileName = "C:\documents\"
.Title = "Browse Files"
Action = .Show
If Action = -1 Then
FileName = .SelectedItems(1)
Else
FileName = ""
End If
End With
End Sub
Sub selectOft()
Call BrowseFile
Cells(5, "C").Value = FileName
End Sub