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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
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,215,387
Messages
6,124,633
Members
449,177
Latest member
Sousanna Aristiadou

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