Sheet selection

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

Using VBA for Excel
How could I go about selecting all of the sheets in a
workbook except for 1 particular sheet. I would like to do
this without having to state the name of each individual
sheet, except for the 1 particular sheet.

Thank You,
 
Sub Tester1()
Const shName As String = "Sheet1"
Dim sh As Worksheet, i As Long, j As Long
i = 1
j = 0
For Each sh In ThisWorkbook.Worksheets
j = j + 1
If LCase(sh.Name) <> LCase(shName) Then
sh.Select sh.Name = Worksheets(i).Name
ElseIf j = 1 Then
i = j + 1
End If
Next


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top