I am looking to append cells containing numbers and text so that the text is removed.
Take 1.1 (Very Low)
as an example of what is in the cell.
I would like to remove (Very Low)
from the cell.
I have figured out how to do this using InStr
.
I was trying to edit cells in a range by cycling through them whilst checking for a string. I would then remove the specified string. You can do this by checking the cell for your string using InStr
and then using Replace
to update the cell contents.
I found a way to do this using:
Dim ws as Worksheet, rCell As Range, rArea As Range
Set rArea = ws.Range("A1:A10")
For Each rCell In rArea.Cells
If InStr(rCell.Value, " (Very Low)") Then
rCell.Value = Replace(rCell.Value, " (Very Low)", "")
End If
Next rCell
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.