PDA

View Full Version : [SOLVED:] How to post only the SaveAs location that a user selects to a Worksheet cell



simora
08-26-2016, 12:42 PM
Trying to write the SaveAs location that a user selects to a Worksheet cell,
and to write ONLY the location without the filename used in Cell A22 & use it in a Variable.

I tried modifying code like this, http://software-solutions-online.com/excel-vba-save-file-dialog-getsaveasfilename/

but, still inelegant and not working for me. Any ideas?

simora
08-26-2016, 01:21 PM
To anyone that was interested, I got this bit to work for me.



Sub PathOnly()
SelectedFiles = Application.GetOpenFilename( _
filefilter:="Excel Files (*.xls*), *.xls*", MultiSelect:=False)
If InStrRev(SelectedFiles, "\") > 0 Then
FolderLocation = Left(SelectedFiles, InStrRev(SelectedFiles, "\"))
End If
Cells(22, 1) = FolderLocation ' TO POST TO A22
End Sub