Hi can someone please tell me if i can use a statement like "if file exists go to userC" instead of the on error statement as shown here?
userC:
ActiveSheet.Copy
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\kenny\Desktop\estimates 05\" & [c5].Value + "#2" & ".xls"
MsgBox "your worksheet has just been saved!"
ActiveWorkbook.Close False
Exit Sub
End Sub
also I have tried usig this piece here to name a file with limited success....
[c5].Value + "#2" & ".xls" so if c5 had "cat" in the cell it would read cat #2 but i am having problems with it also.... any better way to do this???
Code:
Sub SaveActiveSheet()
On Error GoTo userC
ActiveSheet.Copy
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\kenny\Desktop\estimates 05\" & [c5].Value & ".xls"
MsgBox "your worksheet has just been saved!"
ActiveWorkbook.Close False
Exit Sub
userC:
ActiveSheet.Copy
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\kenny\Desktop\estimates 05\" & [c5].Value + "#2" & ".xls"
MsgBox "your worksheet has just been saved!"
ActiveWorkbook.Close False
Exit Sub
End Sub
also I have tried usig this piece here to name a file with limited success....
[c5].Value + "#2" & ".xls" so if c5 had "cat" in the cell it would read cat #2 but i am having problems with it also.... any better way to do this???