Results 1 to 6 of 6

save as to file path using cell name

Threaded View

WillieW save as to file path using... 05-05-2011, 06:01 AM
inesi Re: save as to file path... 05-05-2011, 06:40 AM
WillieW Re: save as to file path... 05-05-2011, 09:20 PM
inesi Re: save as to file path... 05-07-2011, 05:33 PM
corpoppe Re: save as to file path... 07-07-2013, 04:06 PM
arlu1201 Re: save as to file path... 07-08-2013, 01:53 AM
  1. #1
    Registered User
    Join Date
    05-05-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    save as to file path using cell name

    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
    Last edited by pike; 05-05-2011 at 06:17 AM. Reason: add code tags for newbie

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1