ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Save as Macro in excel - Help needed!! (https://www.excelbanter.com/excel-discussion-misc-queries/64262-save-macro-excel-help-needed.html)

Cillian

Save as Macro in excel - Help needed!!
 
Hi,

I have a macro with these lines in it:

FName = Cells(2, 2).Value
ActiveWorkbook.SaveAs Filename:=FName

This works fine and saves the file as the value in the cell - however I want
to be able to call the file by the value in three cells and also add some
text, so the file name would look like:

"Reference (Cells (2,2).Value) Region (Cells (4,2).Value) Day (Cells
(5,2).value)"

Can anyone help??????


--
Cillian

Dave Peterson

Save as Macro in excel - Help needed!!
 
dim myFileName as string
with worksheets("Sheet99")
myfilename = .cells(2,2).value & " Region " & .cells(4,2).value _
& " Day " & .cells(5,2).value
end with

Remember that if any of those cells contain a date, you may have to format the
value to use it as a file name:

.... & " Day " & format(.cells(5,2).value,"yyyymmdd")






Cillian wrote:

Hi,

I have a macro with these lines in it:

FName = Cells(2, 2).Value
ActiveWorkbook.SaveAs Filename:=FName

This works fine and saves the file as the value in the cell - however I want
to be able to call the file by the value in three cells and also add some
text, so the file name would look like:

"Reference (Cells (2,2).Value) Region (Cells (4,2).Value) Day (Cells
(5,2).value)"

Can anyone help??????

--
Cillian


--

Dave Peterson


All times are GMT +1. The time now is 02:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com