ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save As Macro (https://www.excelbanter.com/excel-programming/362867-save-macro.html)

Brian

Save As Macro
 
I am a macro to do a save as.

Code

Sub savesheet()


Application.ScreenUpdating = True
Dim wb As Workbook
Application.ScreenUpdating = False
ActiveSheet.Copy

Set wb = ActiveWorkbook
Application.ScreenUpdating = True
sFilename = "C:\TimeSheet\" & Format(Range("h12").Value,
"mm-dd-yy Job# " & ActiveSheet.Range("h2").Value & " " &
Range("b6").Value)
ans = MsgBox("Save file as " & sFilename)

If ans = vbOK Then
With wb

ActiveSheet.Shapes("Button 2").Select
Selection.Delete

.SaveAs sFilename
.Close False
End With
Application.ScreenUpdating = True
End If
End Sub


Cell "h12" is a date
Cell "h2" is a 6 digit #
Cell "b6" is my name


The problem is with my name. Brian Arnold. When I run the macro my
name comes back "Bria0 Ar0ol1"

Please Help


ward376

Save As Macro
 

Try changing the last .value to .formula.


Bob Phillips

Save As Macro
 
You have the closing bracket in the wrong place

sFilename = "C:\TimeSheet\" & _
Format(Range("h12").Value, "mm-dd-yy Job# ") & _
ActiveSheet.Range("h2").Value & " " & _
Range("b6").Value


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"ward376" wrote in message
oups.com...

Try changing the last .value to .formula.




Brian

Save As Macro
 
Thanks Bob it worked great



Bob Phillips wrote:
You have the closing bracket in the wrong place

sFilename = "C:\TimeSheet\" & _
Format(Range("h12").Value, "mm-dd-yy Job# ") & _
ActiveSheet.Range("h2").Value & " " & _
Range("b6").Value


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"ward376" wrote in message
oups.com...

Try changing the last .value to .formula.




All times are GMT +1. The time now is 07:48 AM.

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