Having Trouble with Deleteing Sheets

Guzzlr

Well-known Member
Joined
Apr 20, 2009
Messages
759
Code:
For Each sht In ActiveWorkbook.Worksheets
    If sht.Visible And sht.Name = ("ASY") And sht.Name = ("TEMP") Then
    sht.Delete
    Worksheets.Add().Name = "ASY"
    Worksheets.Add().Name = "TEMP"
    Sheets("ASY").Move After:=Sheets("DATA")
    Sheets("TEMP").Move After:=Sheets("ASY")
    
    End If
    Next sht

Hello All...
I'm having troubles with my code above to delete the sheets ASY and TEMP.
I've used this before, and it worked, but not now?
Thanks for the help
 

Some videos you may like

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,340
Office Version
  1. 365
Platform
  1. Windows
Try
Code:
    If Sht.Name = "ASY" Or Sht.Name = "TEMP" Then
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,340
Office Version
  1. 365
Platform
  1. Windows
You're welcome
 

Watch MrExcel Video

Forum statistics

Threads
1,109,013
Messages
5,526,268
Members
409,689
Latest member
martin_br

This Week's Hot Topics

Top