VBA SaveAs Questions

elektor

New Member
Joined
Apr 24, 2011
Messages
43
I have the following macro. It saves the "current workbook" as a different name without macro.

Sub Copy()
Dim WS As Worksheet
Dim i As Integer
Dim sarrWS() As String
ReDim sarrWS(1 To ThisWorkbook.Worksheets.Count)
i = 0
For Each WS In ThisWorkbook.Worksheets
i = i + 1
sarrWS(i) = WS.Name
Next WS
ThisWorkbook.Worksheets(sarrWS()).Copy
Application.Dialogs(xlDialogSaveAs).Show
End Sub

It works fine. But I need 2 special features.

1) The macro doesn’t copy sheet s “Stock” and “Results”. The other sheets must be copied.
2) Copied and saved new workbook sheets do not have to sheets password. (Original workbook sheets protected by a password.
How can be modified this macro?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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