Probably simple

C

Carlos

Hi,

Simple code I'm sure, I just can't get my head round it.

I've a number a worksheets that could be added in any order, I need to
extract the sheet which has a name starting with "ilo" and rename it to
whatever I want.

For Each ws In ActiveWorkbook.Worksheets
If Worksheet.Name Is Left("ilo", 3) Then
ws.Activate
Exit Sub
End If

This is what I'm working with, Can anyone amend so I can get this changed?

Thanks
Carl
 
M

Mike H

Hi,

Maybe this

Sub nn()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If Left(ws.Name, 3) = "ilo" Then
ws.Name = "MyName"
Exit Sub
End If
Next ws
End Sub

Mike
 

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

Top