0
First I filter the contents of a table column to get everything that does not contain /.
ActiveSheet.Range("A1").AutoFilter Field:=3, Criteria1:="<>*/*"
With this result, I would like to replace the contents of the cells with their own contents concatenated with the string /SUP. For that I use the Selection.Replace:
Selection.Replace What:="???", Replacement:="???/SUP", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
But it’s not working...
The expected result would be:
cellCOM/ --- replace --- cellCOM/
cellSEM --- replace --- cellSEM/SUP
How can I take the cell content when making this substitution??
There’d be a different or better way to do it??
After filtering, you cannot use the
Selection, in fact it is always good to avoid the use ofSelect. But after the filter you need to use the visible cells to use the functionreplace– danieltakeshi
@danieltakeshi OK. And if there are no visible cells?? how do I proceed?
– Gabriel Hardoim
Creates a conditional to check for visible cells (
Range.SpecialCells(xlCellTypeVisible)), if it has treats the data, otherwise it leaves the conditional or provides a warning message.– danieltakeshi