Macro to save multiple file types with cell reference

IainEyre

New Member
Joined
Feb 22, 2017
Messages
5
Hello,
Wonder if someone could help trying to build a button that will do some work for me and i am close but can not seem to get it right. Has anyone got any ideas.
Sub Save()

'
' Save1 Macro
' Saves document with date, then pdf, then alters the file and saves file for reporting.
'

'Saves file with todays date'

Dim path As String
Dim filename1 As String
path = ThisWorkbook.path & "\" 'Same path as current project that the User opened.
filename1 = "ReportName " & Format(Range("s4").Value)
Application.DisplayAlerts = False
ActiveWorkbook.SaveCopyAs Filename:=path & filename1 & ".xlsm"
Application.DisplayAlerts = True

'Saves file with todays date and pdf'
Application.DisplayAlerts = False
ActiveWorkbook.SaveCopyAs Filename:=path & filename1 & ".pdf"
Application.DisplayAlerts = True

'Removes Unwanted Rows'
Rows("1:2").Select
Range("D1").Activate
Selection.Delete Shift:=xlUp
ActiveWindow.SmallScroll Down:=6
Rows("16:24").Select
Selection.Delete Shift:=xlUp

'Saves File For Reporting'

ActiveWorkbook.SaveAs Filename:= _
"D:\" & Format(Range("s2").Value) & ".xlsm", _
FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False


End Sub

Bashing me head against a wall at the moment
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,214,605
Messages
6,120,473
Members
448,967
Latest member
visheshkotha

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