On 2002-03-08 20:14, Anonymous wrote:
I want to deselect sheets 1 (Master) and 2 (Prep) where I have another 40 sheets also selected in a macro. So as to leave only the 40 sheets selected.
If you have 40 sheets + these 2 then this
may help....
Sub SelectAllSheets()
Dim sh As Worksheet
Dim i As Single
'make sure we Start off with another sheet other then these 2
Do Until ActiveSheet.Name <> "Master" And ActiveSheet.Name <> "Prep"
Sheets(i + 1).Select
i = i + 1
Loop
'Now select all bar 2
For Each sh In ActiveWorkbook.Sheets
If sh.Name <> "Master" And sh.Name <> "Prep" Then
sh.Select False
End If
Next
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.