String Starts with in VBA

katzav

New Member
Joined
Oct 5, 2009
Messages
24
Hi,

I am trying to hide all the sheets that are not starting with either of the next strings "=> IT" or just "IT", is there a string.starts with function in VBA?

Thanks,
Isaac
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Isaac

There isn't a specific 'string starts' function, but there are plentyof other methods for checking strings.

Perhaps you could use this.
Code:
For Each ws In Worksheets
 
     If ws.Name Like "=>IT*" Or ws.Name Like "IT*" Then
        ws.Visible = xlHidden
    End If
 
Next ws
 
Upvote 0
There is an InStr function which can check if one string exists within another, or you could use an If/Or, like
Code:
If Left(Sheets(1).Name,5) = "=> IT" Or Left(Sheets(1).Name, 2) = "IT" Then...
 
Upvote 0

Forum statistics

Threads
1,223,276
Messages
6,171,140
Members
452,381
Latest member
Nova88

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