In cell C5, I have my users "Full Name" in Cell H5, I have my user "SSN" I would like to use VBA to Save to a file name that combines the two cell as follows
Cell C5 = John Moore Cell H5 = 222-33-4444 I want to save as " John Moore - 4444" (using only the last 4 of the SSN) if possible I would like the save as filename to be Moore -4444 (Last Name and Last 4 of SSN but this may be to difficult since the first and last name lenght will vary. I currently using the follow code that work but it save as the full Name and the entire SSN "John Moore - 222-333-4444. I don't understand what I need to do to modify the code to get the file name to be
1 John Moore - 4444 or
2 Moore - 4444
Here's the current code i"m using
Private Sub CommandButton1_Click()
'Sub CommandButton1_Click()
Dim flPath As String
flPath = "C:\Budget\"
flPath = flPath & Format([C5], "Full Name") & " - " & [H5] & ".xls"
flPath = Application.GetSaveAsFilename(flPath, "Microsoft Office Excel Workbook (*.xls), *.xls")
If flPath <> "False" Then ThisWorkbook.SaveAs flPath
End Sub
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
End Sub
I would be grateful for any help
Bookmarks