How to find .Name of leftmost worksheet tab

J

Jimbo213

A workbook is created by another application.
I want to find the first [leftmost] worksheet name - and it is always
different
The second sheet is named Sheet1
The third sheet is named Sheet2
The fourth sheet is named Sheet3

It may be safe to assume that this is really "sheet 4" that has been
renamed, but I'd prefer to have a solution that finds the leftmost tab .Name
positionally.

DIM FirstSheet as String
..... your helpful code ....
Sheets(FirstSheet).Name = "CompareX"

Thanks for your reply & assistance.
Jimbo213
 
D

Dave Peterson

sheets(1).name = "CompareX"
or
worksheets(1).name = "CompareX"

There could be a difference.

If that first sheet is a non-worksheet (like a chartsheet), you'll see.)

A workbook is created by another application.
I want to find the first [leftmost] worksheet name - and it is always
different
The second sheet is named Sheet1
The third sheet is named Sheet2
The fourth sheet is named Sheet3

It may be safe to assume that this is really "sheet 4" that has been
renamed, but I'd prefer to have a solution that finds the leftmost tab .Name
positionally.

DIM FirstSheet as String
.... your helpful code ....
Sheets(FirstSheet).Name = "CompareX"

Thanks for your reply & assistance.
Jimbo213
 

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