Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50090

Macro to look at part content of a cell and Hide row

$
0
0
Hi,

I have a small piece of code that goes down a sheet and looks at the content of the cell in column A. Some cells will begin with the string WK21GT01- the rows that these cells are in I want to Hide.

I have a small macro that works for a full string as :-

Code:

Sub HideWKGT01()

Dim Cell As Range
For Each Cell in Range ("A:A")
If UCase(Cell.Value) = "WK21GT01-SVRS077N" Then
Cell.EntireRow.Hidden = True
End If
Next
End Sub

This works fine where a cell contains the specific string, but after the dash in the WK21GT01- string there are a number of different possibilities, so I just need to Hide all rows where the cell in Column "A" contains part string "WK21GT01-".

Your help is appreciated.

Regards

Viewing all articles
Browse latest Browse all 50090

Trending Articles