ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving Cell value as filename (https://www.excelbanter.com/excel-programming/272583-saving-cell-value-filename.html)

Kathy B

Saving Cell value as filename
 
I'm working on a project where I want to be able to take the text (for
example RICH RD SE) that is in cell C1 and by use of macro or code
save the workbook as "C1".xls (in this example, RICH RD SE.xls),
close the current workbook with the new name and then open a new copy
of the original.

I managed to get it to work ONCE, but when I ran the macro on
subsequent workbooks, it would try to name them EACH "RICH RD SE.xls"
..

I am assuming that I need to use some sort of variable statement, but
being the extreme novice in VBA, I can't quite figure out the syntax.

Any ideas?

Chip Pearson

Saving Cell value as filename
 
Kathy,

Try something like

ThisWorkbook.SaveAs filename:=Range("C1") & ".xls"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Kathy B" wrote in message
om...
I'm working on a project where I want to be able to take the

text (for
example RICH RD SE) that is in cell C1 and by use of macro or

code
save the workbook as "C1".xls (in this example, RICH RD

SE.xls),
close the current workbook with the new name and then open a new

copy
of the original.

I managed to get it to work ONCE, but when I ran the macro on
subsequent workbooks, it would try to name them EACH "RICH RD

SE.xls"
.

I am assuming that I need to use some sort of variable

statement, but
being the extreme novice in VBA, I can't quite figure out the

syntax.

Any ideas?





All times are GMT +1. The time now is 04:49 AM.

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