ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Finding the first few characters in a cell (https://www.excelbanter.com/excel-programming/272457-finding-first-few-characters-cell.html)

Ben E

Finding the first few characters in a cell
 
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



Cecilkumara Fernando

Finding the first few characters in a cell
 
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

"Ben E" wrote in message
...
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






All times are GMT +1. The time now is 09:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com