ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Macro to save form to file (https://www.excelbanter.com/excel-programming/331487-using-macro-save-form-file.html)

DB

Using Macro to save form to file
 
I need to provide an easy way for an excel form to be saved with the data
(without sharing the entire workbook and the underlying formulas). I have
figured out how to print the form; however, there is the need to distribute
electronically.
Think it need to be a macro - but I can't figure it out and how to also
include header and footer....

Dave Peterson[_5_]

Using Macro to save form to file
 
Since you don't want to share the entire workbook, record a macro when you copy
the worksheets to a new workbook.

Then for each sheet in that new workbook, select all the cells and copy|paste
special values.

I'd end up with something like:

Option Explicit
Sub testme()

Dim newWkbk As Workbook
Dim wks As Worksheet

Worksheets(Array("sheet1", "sheet3", "sheet5")).Copy

Set newWkbk = ActiveWorkbook
For Each wks In newWkbk.Worksheets
With wks.UsedRange
.Copy
.PasteSpecial Paste:=xlPasteValues
End With
Next wks

End Sub




DB wrote:

I need to provide an easy way for an excel form to be saved with the data
(without sharing the entire workbook and the underlying formulas). I have
figured out how to print the form; however, there is the need to distribute
electronically.
Think it need to be a macro - but I can't figure it out and how to also
include header and footer....


--

Dave Peterson


All times are GMT +1. The time now is 05:30 AM.

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