macro - Select All Sheets

Cosmos75

Active Member
Joined
Feb 28, 2002
Messages
359
I am trying to create a macro to select all sheets in active workbook and copy them into a new book (Named "Copy.xls") that doesn't contain the macros and buttons in the original used to launch the macro. Any quick way to do this?

At the least, I would like to know how to write code to select all sheets. THANKS!
This message was edited by Cosmos75 on 2002-04-08 12:03
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Worksheets.copy will copy all the worksheets to a new workbook. As for not copying code, I do not know.
 
Upvote 0
Sub Select_All_Sheets()
Dim sht As Worksheet
Dim SelectMe() As String
Dim s As Integer
For Each sht In Worksheets
s = s + 1
ReDim Preserve SelectMe(1 To s) As String
SelectMe(s) = sht.Name
Sheets(SelectMe).Select
Next
End Sub
 
Upvote 0
Got this code to select buttons and delete them.

ActiveSheet.Shapes.Range(Array("Button 1", "Button 2", "Button 3")).Select

Is there a way to get it to select all the buttons and delete them?
 
Upvote 0

Forum statistics

Threads
1,213,561
Messages
6,114,316
Members
448,564
Latest member
ED38

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