View Single Post
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

I'm not sure what you have in Q1 and B9, but maybe...

Option Explicit
Sub testme()

Dim wks As Worksheet

Set wks = ActiveWorkbook.Worksheets("giro")

wks.Copy 'to a new workbook

With ActiveSheet
.Parent.SaveAs Filename:="C:\" _
& .Range("q1").Value & .Range("b9").Value & ".xls", _
FileFormat:=xlWorkbookNormal
.Parent.Close savechanges:=False
End With

End Sub

There is no error checking -- make sure those values in Q1 and B9 will make a
nice name.

(Dates are problems. Windows files can't have /'s in them.)

.Parent.SaveAs Filename:="C:\" _
& format(.Range("q1").Value, "yyyy_mm_dd") _
& .Range("b9").Value & ".xls", _
FileFormat:=xlWorkbookNormal

Might work for you.

KingKarl wrote:

I'm struggling with a problem that I bet is easy as ****, but anyway...

I want to make a macro that saves only sheet number five (named "giro") of
my workbook, and at the same time gives the file the name of the value of
cell Q1 and cell B9 on this sheet. Is this possible?

Thanx a lot in advance...


--

Dave Peterson