ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving Individual Worksheets (https://www.excelbanter.com/excel-programming/300967-saving-individual-worksheets.html)

Jako[_15_]

Saving Individual Worksheets
 
I am using this code to save my workbooks:


'--------------------------------------------------------------------------

Sub SaveAsTodaysDate()
Dim sFileName As String, sPath As String
Application.ScreenUpdating = False

sPath = "C:\LOGS\" 'change path here
sFileName = "NW Failures " + Format(Now(), "dd.mm.yyyy") & ".xls"
ActiveWorkbook.SaveAs (sPath & sFileName)
Application.ScreenUpdating = True
MsgBox ("File - " & sFileName & " - Saved Successfully"), vbOKOnly

End Sub

'--------------------------------------------------------------------------

This save the workbook with the date of creation.

What i want to do is save an individual worksheet with the sam
filename formatting as above.

The worksheets i have are called "PASS" and "FAIL".

Can anyine suggest a way to do this please.

TI

--
Message posted from http://www.ExcelForum.com


ross

Saving Individual Worksheets
 
Hi,

i have used this code, but it's not working for me at the mo,?-why? it
has before. The idea is simple, i copy the page to a new workbook and
sane it with a file name form the input box. I am doing some work to
day which might improve on this, if what i do is any good i'll post
back.

so this might give you a few ideas?

Sub CopyAndSaveSheet()
'
' CopyAndSaveSheet Macro
' wrote for luck by ross
'
' Keyboard Shortcut: Ctrl+Shift+T
'
On Error GoTo oh****e
A = "D:\Documents and Settings\702292505\My Documents\"
B = InputBox("Whats the name then pal?? eh. yeah you gimp",
"SheetSaver .::by::. RamCo Ltd.")
ActiveSheet.Copy
sName = ActiveSheet.Name

Workbooks.Add
Sheets(1).Name = sName
Sheets(sName).Activate
Range("A1").PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
ActiveWorkbook.SaveAs FileName:=A & B, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=True

ActiveWorkbook.Close

Exit Sub

oh****e:
Exit Sub
End Sub


good luck
ross


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

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