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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,223,240
Messages
6,170,951
Members
452,368
Latest member
jayp2104

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