View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] alexmillner@gmail.com is offline
external usenet poster
 
Posts: 11
Default Save as saves selected worksheet instead of whole workbook

Hi -

I have a macro that does a save as action and saves as a name from the
values of a couple cells... and it seems to work okay. The problem is I
have 3 worksheets and it only saves the active worksheet... can anybody
help me out. It would be much appreciated.

This is what I've got

Sub SaveAs()

Dim uname

With ActiveWorkbook.Worksheets("sheet1")
uname = .Range("B2").Value & " " & _
.Range("B3").Value
End With
ActiveWorkbook.SaveAs ThisWorkbook.Name _
& " " & " " & uname & ".xls"
ActiveWorkbook.Close True
End Sub


Again, I need it to save the entire workbook to a new file and not just
the avctive worksheet.
Thanks
A