Finding the first few characters in a cell

B

Ben E

Can anybody help?

What I would like to do is run a macro that will hide
certain rows within a workbook, the position of the rows
is variable, however all of the row I would like to keep
all have the same first 5 Character, (SubTL) I can make it
run through the data and remove lines. The problem is I
can't make it identify which rows contain (SubTL) as the
first 5 Character. Any Ideas?

Thank for you help.

Ben
 
C

Cecilkumara Fernando

Ben,
Assumed the column is A

Sub Macro10()
For i = 25 To 2 Step -1
If Not Evaluate("EXACT(""SubTL"",LEFT(A" & i & ",5))") Then
Range("A" & i).Delete shift:=xlUp
End If
Next i
End Sub

HTH
Cecil
 

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