Macro to Copy Sheet to a Network Location

paulrh

New Member
Joined
Nov 4, 2015
Messages
15
Multiple times per day I update a sheet within a workbook. A second sheet in the same workbook has a reduced number of cells linked to the "master" sheet I edit. I would like a macro to copy the limited data sheet to a network location from where it will be viewed by general users who do not require the full master sheet data.

The limited sheet will have a fixed name and the destination file will also be fixed, being overwritten each time I run the macro.

Thanks in advance.

Paul
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
If you add a button somewhere on the sheet you can use this:

Code:
Sub Whateveryounamethisbutton() 

Dim sFileName As String    sFileName = "sheetname" & ".xlsm" 
    ActiveSheet.SaveAs Filename:="n:\folder\subfolder\" & sFileName 

End Sub

When you add the button, it gives it a default name. You can change it if you want.
"n:" in this case will need to be changed to whatever your network drive letter is.
If you do not want the macro capabilities in the uploaded version, change the file extension to .xls
 
Last edited:
Upvote 0
You can also upload it as a PDF with this code:
Code:
Sub Whateveryounamethisbutton() 

Dim sFileName As String    sFileName = "sheetname" 
    ActiveSheet.ExportAsFixedFormat _
     Type:=x1TypePDF,  Filename:="n:\folder\subfolder\" & sFileName 
     Quality:=xlQualityStandard, _
     IncludeDocProperties:=False, _
     IgnorePrintAreas:=False, _
     OpenAfterPublish:=False

End Sub

The reason I used the Dim As String line is because in my use, I also added parameters from the spreadsheet in the file nme.
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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