Sub SplitStuff()
Dim cel As Range
For Each cel In Range(("A2"), Range("a2").End(xlDown))
On Error Resume Next
cel.Value = Trim(Split(cel.Value, "-")(1))
On Error GoTo 0
Next cel
For Each cel In Range(("A2"), Range("a2").End(xlDown))
On Error Resume Next
cel.Value = Trim(Split(cel.Value, "to")(1))
Next cel
On Error GoTo 0
For Each cel In Range(("A2"), Range("a2").End(xlDown))
On Error Resume Next
cel.Value = Trim(Split(cel.Value, ">")(1))
Next cel
On Error GoTo 0
Columns("A:A").Replace What:="+", Replacement:="", LookAt:=xlPart, SearchOrder:=xlByRows, _
MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Columns("A:A").Replace What:=",", Replacement:="", LookAt:=xlPart, SearchOrder:=xlByRows, _
MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
End Sub
Hi,
I have to format data like as mentioned below on regular basis.I need macro to find and replace the values quickly.
Please help to modify the code.
Employee Count
1000-9999
1000-9999
1000-9999
1000-9999
1000-9999
100 to 200
100>200
100+
100,
Over 1000
I have to keep all the data after hyphen that is 9999
I have to keep all the data after 'to' that is 200
I have to keep all the data after '>' that is 200
I have to keep the data after 'Over'
and remove trailing + and commas all in one function.
The macro should help me to clean these requirements.
Thanks,
Bookmarks