Using a Range within a Macro

I'm using the following code to remove certain text within assigned cells. All works great. Except, I am adding more cells that require this code. Is there a simpler way of not having to list each cell.

Sub Removetext()
    For Each c In Range("D18,D20,D22,D24,D26,D28,D30,D32,D34,D61,D63,D65,D67,D69,D71,D73,D75,D77,D79,D81,D83,D85")
        If InStr(c.Value, "{") > 0 Then
            c.Value = Left(c.Value, InStr(c.Value, "{") - 1)
        End If
            If InStr(c.Value, "*") > 0 Then
            c.Value = Left(c.Value, InStr(c.Value, "*") - 1)
        End If
    Next c
End Sub

I've searched other post and could not find anything.



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation