help with saveas

  • Thread starter Thread starter stevenknowles
  • Start date Start date
S

stevenknowles

i need help with excel

i got three cells with different text in it ....

i want to use all the cells to creat a file name to save as

example below

a1 = 2004
a2 = jan
a3 = name

using the cells i want to save as

the file name should look like this

2004-jan-name.xls

i want the full code im not familar with excel please.

thanx alo
 
Dim Yoursheet as worksheet
set YourSheet = Worksheets("YourSheetName")

'following is one line !!!!
YourFileName = YourSheet.Cells(1,1).Value & "-" & YourSheet.Cells(1,2).Value
& "-" &YourSheet.Cells(1,3).Value & ".xls"
 
I may have missed the point but in simple terms all you need to do i
something along the lines ...

dim a_str1 as string
dim b_str1 as string
dim c_str1 as string
dim sname as string

a_str1=activesheet.cells(1,1).value
b_str1=activesheet.cells(1,2).value
c_str1=activesheet.cells(1,3).value

sname=trim(a_str1)+"-"+trim(b_str1)+"-"+trim(c_str1)+".xls"

ActiveWorkbook.SaveAs Filename:=sname, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=Fals
 
With Activesheet
Activeworkbook.SaveAs FileName:=.Range("A1").Value & "-" & _

..Range("A2").Value & "-" & _

..Range("A3").Value & ".xls"
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top