VBA Macro error

ariel20029

Board Regular
Joined
Jun 20, 2013
Messages
97
Hi, I am trying to create a macro to saveas a file based on the information in cell C80. The macro is throwing an error on the last line saying compile error syntax error.
Can you please help.
thanks,
Sharon



Dim Path As String
Dim FileName1 As String

Path = "C:\PS CANCEL"
FileName1 = Range("C80")
ActiveWorkbook.SaveAs FileName:=Path & FileName1&".xls",FileFormat:xlNormal
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Have you tried it with a backslash? and an = sign after file format.

Code:
[COLOR=#333333]
ActiveWorkbook.SaveAs FileName:=Path & [/COLOR][COLOR=#ff0000]"\" &[/COLOR][COLOR=#333333] FileName1 & ".xls", FileFormat:[/COLOR][COLOR=#ff0000]= [/COLOR][COLOR=#333333]xlNormal[/COLOR]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,594
Members
452,656
Latest member
earth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top