Saving a file taken from cells in a workbook and asking where to save it and in what format

K0st4din

Well-known Member
Joined
Feb 8, 2012
Messages
501
Office Version
  1. 2016
  2. 2013
  3. 2011
  4. 2010
  5. 2007
Platform
  1. Windows
Hello, everyone,
I found this macro and modified it a bit to suit my needs.
It takes what is written from specific cells and saves it.
However, it clearly needs something more added, because I'm running into the following problems:
When it saves it, taking the text from the specific cells makes it merged: IvanIvanov12024, I don't know how to give it the spaces in the macro to make it Ivan Ivanov 1 2024.
The other thing I don't know how to do is that in this workbook I have more worksheets, and this macro saves, just one, I want to save the whole workbook.
And the last one is I don't know how to make the SaveAS dialog box - so that I can specify where to save it (or a second option, ask me where again, but if possible it will self-navigate to the location where the file itself is located).
Thank you in advance for your assistance.
VBA Code:
Sub SaveAsA1()
ThisFile = Range("J1").Value & Range("C2").Value & Range("B4").Value & Range("A4").Value
ActiveWorkbook.SaveAs fileName:=ThisFile
Application.GetSaveAsFilename
End Sub
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
I think I found a way to separate my text and it went like this with these quotes:
VBA Code:
ThisFile = Range("J1").Value & " " & Range("C2").Value & " " & Range("B4").Value & " " & Range("A4").Value

All I have left is how to save the new file in the same place where I opened the one I'm working on.
I don't know if I'm explaining it properly, so I'll write it a little longer.
I have a folder on my computer in which the file "Monthly report" is located, I open it and fill in the necessary information, then taking the information from the necessary cells, the file acquires a new name (in the example) Ivan Ivanov 1 2024 and save in the same folder where my file is, but with the new name. I make some attempts to do it myself and in one of the attempts something worked, but when I opened the file I saw that all the modules and macros in the new one were gone (lost) even though it was saved as .xls
I have absolutely no idea how to have everything old in the new file, like in the "mother file"
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,269
Members
452,628
Latest member
dd2

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