Sheet Selection

cstimart

Well-known Member
Joined
Feb 25, 2010
Messages
1,180
I have a workbook that I will be opening to extract data, and the specific tab I want will have a specific name with some date included. (i.e. Numbers 06.01.11)

Is it possible to select that sheet using "Numbers*" or some other fashion?
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Maybe like this

Code:
For i = 1 To Worksheets.Count
    If Worksheets(i).Name Like "Numbers*" Then
        Worksheets(i).Select
        Exit For
    End If
Next i
 
Upvote 0
Is it the only worksheet with a name that begins Numbers?

Something like this might work.
Code:
Dim ws As Worksheet
Dim wsNum As Worksheet
 
For Each ws In Workbooks("NameOfWorkbookYouOened")
      If ws.Name Like "Numbers*" Then
            Set wsNum = ws
      End If
Next ws
 
wsNum.Select
You could add Exit For after the Set part if there are a lot of worksheets in the opened workbook.

I've included the Select to show how you could select the worksheet

You shouldn't need to do that though since you have a reference, wsNum, to it
and you can use that in the later code.
 
Upvote 0

Forum statistics

Threads
1,224,558
Messages
6,179,512
Members
452,920
Latest member
jaspers

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top