Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Sheet Names in Excel

Status
Not open for further replies.

Dan8376

Technical User
Jan 29, 2002
25
US
Hi,

I want to delete all sheets with a name length of 5. I'm having problems with the vb syntax for excel. I know it should be something like this.

set wb = ActiveWorkbook
set sht = Sheets
For Each sht in wb
If len(sht.Name) = 5 Then
sht.Delete
End if
Next

Thanks
Dan
 
Try this

Set sht = Sheets
For Each sht In Workheets
If Len(sht.Name) = 5 Then
sht.Delete
End If
Next Matt Smith

No two nulls are the same
 
Matt,

That helped me figure out my problem.

Thanks
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top