Yet possible with worksheet formula functions like TRIM, CLEAN and MID !I need a regexp macro to clean up spaces and /
Is it possible?
you are correct sir, I have thisHi !
Yet possible with worksheet formula functions like TRIM, CLEAN and MID !
By general VBA using Replace function …
Sub Test()
Dim arr, i As Long, x
arr = Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row).Value
For i = 1 To UBound(arr, 1)
arr(i, 1) = Trim(Split(arr(i, 1), "/")(0))
Next i
Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row).Offset(, 1).Value = arr
End Sub
Sub test()
With Range("a1", Range("a" & Rows.Count).End(xlUp))
.Replace " ", "", 2
.Value = Evaluate("if(" & .Address & "<>"""",iferror(replace(" & .Address & "&""/"",find(""/""," & _
.Address & "),len(" & .Address & "),"""")," & .Address & "),"""")")
End With
End Sub
Sub test()
With Range("a1", Range("a" & Rows.Count).End(xlUp))
.Value = Evaluate("if(" & .Address & "<>"""",iferror(replace(" & .Address & "&""/"",find(""/""," & _
.Address & "),len(" & .Address & "),"""")," & .Address & "),"""")")
EndWith
EndSub
Sub test()
Columns("a").Replace "/*", "", 2
End Sub
Sub test()
With Range("a1", Range("a" & Rows.Count).End(xlUp))
.Replace " ", "", 1
.Value = Evaluate("if(" & .Address & "<>"""",iferror(trim(replace(" & .Address & "&""/"",find(""/""," & _
.Address & "),len(" & .Address & "),"""")),trim(" & .Address & ")),"""")")
End With
End Sub