ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   This one is tricky....Macro to save file as cell value x in di (https://www.excelbanter.com/excel-discussion-misc-queries/593-re-one-tricky-macro-save-file-cell-value-x-di.html)

Andy

This one is tricky....Macro to save file as cell value x in di
 
Thankyou very much for your help this worked well...

"JE McGimpsey" wrote:

This is rather an FAQ if you look in the archives:

http://groups.google.com/advanced_gr...=group:*excel*

One way:

Public Sub SaveInB2AsA2()
Const sPATH As String = "R:/SALES/Team 318/"
ThisWorkbook.SaveAs _
Filename:=sPATH & Range("B2").Text & _
Application.PathSeparator & Range("A2").Text & ".xls"
End Sub



In article ,
"Andy" wrote:

Two cells A1 & B2

I am trying to create a Macro to attach to a button to Save an .xls as

"A1".xls in directory R:/SALES/Team 318/"B2"

instead of typing it in all of the time....

Any helpers? Past attempts at this have failed.....the winner will get a big
MVP vote!



Andy

Thanks Jason. There was a bug in this that I couldnt work out. Thanks for
your help though. The next three worked....

"Jason Morin" wrote:

Try something like:

Sub Test()
Dim mypath As String
Dim sfile As Range, sdir As Range

mypath = "R:\SALES\Team 318\"
Set sfile = Sheets("Sheet1").Range("A1")
Set sdir = Sheets("Sheet1").Range("B2")

ThisWorkbook.SaveAs Filename:=mypath & sdir & "\" & sfile

End Sub

---
HTH
Jason
Atlanta, GA

-----Original Message-----
Hi

Two cells A1 & B2

I am trying to create a Macro to attach to a button to

Save an .xls as

"A1".xls in directory R:/SALES/Team 318/"B2"

instead of typing it in all of the time....

Any helpers? Past attempts at this have failed.....the

winner will get a big
MVP vote!

Absolute respect

Andy

.



Andy

thanks for this. It worked.

"tjtjjtjt" wrote:

Andy,
I just copied the filepath from your post--
As the other posts show, if you are on a Windows machine, the slashes from
your filepath are going the wrong way.

tj

"tjtjjtjt" wrote:

How about something like this:

Sub SvFile()

ActiveWorkbook.SaveAs Filename:= _
"R:/SALES/Team 318" & Range("B1").Value _
& "\" & Range("A1").Value & ".xls"

End Sub

tj

"Andy" wrote:

Hi

Two cells A1 & B2

I am trying to create a Macro to attach to a button to Save an .xls as

"A1".xls in directory R:/SALES/Team 318/"B2"

instead of typing it in all of the time....

Any helpers? Past attempts at this have failed.....the winner will get a big
MVP vote!

Absolute respect

Andy


Andy

Thanks Bob.....this did the trick as it was the least code for the three
responses. I appreciate your help. Youre not from Brisbane?

"Bob Phillips" wrote:

ActiveWorkbook.SaveAs Filename:= "R:\SALES\Team 318\" & Range("B1").Value &
"\" & Range("A1").Value & ".xls"

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Andy" wrote in message
...
Hi

Two cells A1 & B2

I am trying to create a Macro to attach to a button to Save an .xls as

"A1".xls in directory R:/SALES/Team 318/"B2"

instead of typing it in all of the time....

Any helpers? Past attempts at this have failed.....the winner will get a

big
MVP vote!

Absolute respect

Andy





Bob Phillips

Not quite, South Coast of England.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Andy" wrote in message
...
Thanks Bob.....this did the trick as it was the least code for the three
responses. I appreciate your help. Youre not from Brisbane?

"Bob Phillips" wrote:

ActiveWorkbook.SaveAs Filename:= "R:\SALES\Team 318\" &

Range("B1").Value &
"\" & Range("A1").Value & ".xls"

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Andy" wrote in message
...
Hi

Two cells A1 & B2

I am trying to create a Macro to attach to a button to Save an .xls as

"A1".xls in directory R:/SALES/Team 318/"B2"

instead of typing it in all of the time....

Any helpers? Past attempts at this have failed.....the winner will get

a
big
MVP vote!

Absolute respect

Andy








All times are GMT +1. The time now is 11:02 PM.

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