Finding the first few characters in a cell

  • Thread starter Thread starter Ben E
  • Start date Start date
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
 
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
 
Back
Top