Hi , I am seeking for help of truncate a specific character from range of words in a columns.
In the raange of column, some cell might contain that specific character but some dont.
The result will then substitutes its original data.
any one can help ?
I tried
Sub remove_text_after_char()
Dim rng As Range
Dim cell As Range
Set rng = Application.Selection
For Each cell In rng
cell.Offset(0, 1).Value = Left(cell, InStr(cell, "@") - 1)
Next cell
End Sub
but this will give an error when a cell doesnt consists of that character "@" and yet its result will be copied to next column ( cell)
but I was thinking of getting the result to replace its original data.
In the raange of column, some cell might contain that specific character but some dont.
The result will then substitutes its original data.
any one can help ?
I tried
Sub remove_text_after_char()
Dim rng As Range
Dim cell As Range
Set rng = Application.Selection
For Each cell In rng
cell.Offset(0, 1).Value = Left(cell, InStr(cell, "@") - 1)
Next cell
End Sub
but this will give an error when a cell doesnt consists of that character "@" and yet its result will be copied to next column ( cell)
but I was thinking of getting the result to replace its original data.