Save-as filename from multiple cells help

higguns

New Member
Joined
Mar 10, 2018
Messages
9
Hello,

Looking for some help with some code. I managed to search and then modified the code to work for me so far, but need a bit of help to get it the last bit to make it perfect.

The code takes data from 3 cells and inputs the data into the save-as dialog box and lets you make changes to the file name and/or save location if needed.

What I need to achieve is to take the data from cell H12 (the 3rd cell referenced in the code below) and have it ignore the last 2 words (which are separated by a comma). I know the could be put into a different cell to solve this problem, but they all need to be next to each other in sentence format and aligned to the left of the cell. This data will change and adjusting the cell width everything to have things line up isn't feasible.

Here's the code:

Code:
Sub SaveAsString()

Dim strPath As String
Dim strFolderPath As String

strFolderPath = "D:\Fire Alarm Services\"

        strPath = strFolderPath & _
        Range("K1").Value & " " & _
        Range("N10").Value & " " & _
        Range("H12").Value & " " & _
        Format(Range("H10").Value, "mmm dd yyyy") & ".xlsm"

fileSaveName = Application.GetSaveAsFilename(strPath _
 , fileFilter:="Excel Files (*.xlsm), *.xlsm")

End Sub

All help is greatly appreciated!
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hey @higguns,

Are both of of the last two words separated by a comma? Like ", word1, word2"? Or is there just a comma preceding the last two words? Like ", word1 word2"?

Brian
 
Upvote 0
Hey @higguns,

Are both of of the last two words separated by a comma? Like ", word1, word2"? Or is there just a comma preceding the last two words? Like ", word1 word2"?

Brian

Brian,

They are always gonna be separated by a comma as in: word1, word2

Here's an example of the full cell text for H12 with the bold text being what I want it to ignore all the time:

123 Main St. Toronto, ON
or
456 Main St. N Mississauga, ON

Thanks,
Mike
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,214
Members
453,024
Latest member
Wingit77

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top