Mike TheSpike
New Member
- Joined
- Jul 12, 2021
- Messages
- 40
- Office Version
- 2010
- Platform
- Windows
Hi there, pls help. this code is not working when i select specific column.
Thanks for your help,
Mike
VBA Code:
Sub removeExcess_domain()
Dim Cell As Range
Dim tmp As String
Dim Lr As Long
Lr = Cells(Rows.Count, "L").End(xlUp).Row
'loop through every cell in range and remove characters after ?
For Each Cell In Range("L2:L" & Lr)
tmp = cell.Value
'
cell.Value = Left(tmp, InStr(tmp, "?") - 1)
Next
End Sub
Thanks for your help,
Mike