Reputation: 159
I am trying to delete all words after the first occurrence of an open parentheses in all cells starting from cell D14. I keep coming up with a Object Required error, and not sure where the issue lies.
Dim startRow As Integer
Dim pos_of_parenth As Integer
Dim resultString as String
startRow = 15
With Windows(NewTemplateName)
.Activate
.ActiveSheet.Range("D" & startRow).Select
Do While .ActiveSheet.Range("D" & startRow).Value <> ""
resultString = ""
pos_of_parenth = InStr(1, ActiveSheet.Range("D" & startRow).Text, "(", CompareMethod.Text)
resultString = Left(.ActiveSheet.Range("D" & startRow).Value, pos_of_parenth)
startRow = startRow + 1
Loop
End With
Upvotes: 0
Views: 44
Reputation: 159
I also ended up fixing it by simply getting rid of the "CompareMethod.Text" entirely
Upvotes: 0