Thread
:
problems getting this macro to work
View Single Post
#
2
Posted to microsoft.public.excel.misc
Claus Busch
external usenet poster
Posts: 3,872
problems getting this macro to work
Hi Ditchy,
Am Mon, 12 May 2014 00:29:43 -0700 (PDT) schrieb
:
I am trying to copy a sheet, saving as a new workbook, values & number formats
also with the filename taken from (A1) all with the click of a button, sounds easy!
here is the macro
try:
Sub Test()
Dim myFileName As String
Dim myPath As String
myPath = "C:\Users\Ditchy\Desktop\"
Worksheets(1).Copy
With ActiveSheet
myFileName = .Range("A1").Value & ".xls"
With .UsedRange
.Value = .Value
End With
End With
With ActiveWorkbook
.SaveAs Filename:=myPath & myFileName, FileFormat:=xlWorkbookNormal
.Close
End With
End Sub
Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
Reply With Quote
Claus Busch
View Public Profile
Find all posts by Claus Busch