In support of this forum thread
https://excelfox.com/forum/showthrea...ll=1#post16718
In worksheet String to search is the following:
_____ Workbook: VBA delete everything between two newlines where the string appears.xlsx ( Using Excel 2007 32 bit )
Worksheet: String to search
Row\Col A 1 2 paragraph/line 3 4 searched string 5 #VBA
Here is the given input examples ( The OP gave 4 cells , but for demo here I will put them all in the same code box and separate the 4 examples with a line. Black is the before/input , and Blue the after/ wanted output
OK so it looks quite clear what is needed. The OPs explanation does confirm to this, …. if the given string is found in any excel cell then delete everything between two newlines where the string appears.Code:in VBA if the given string is found then delete everything between two newlines where the string appears. "Looking for help in VBA" if the given string is found in any paragraph/line excel cell then delete everything between two newlines where the string appears. in VBA if the given string is found then delete everything between two newlines where the string appears. "Looking for help in VBA"searched*string if the given string is found in any excel cell then delete everything between two newlines where the string appears. in VBA if the given string is found then delete everything between two newlines where the string appears. "Looking for help in VBA" if the given string is found in any excel cell then delete everything between two newlines where the string appears.
in VBA if the given string is found then delete everything between two newlines where the string appears. "Looking for help in #VBA" if the given string is found in any excel cell then delete paragraph/line everything between two newlines where the string appears. in VBA if the given string is found then delete paragraph/line everything between two newlines where the string appears. "Looking for help in VBA" if the given string is found in any excel cell then delete everything between two newlines where the string appears. searched*string in VBA if the given string is found then delete everything between two newlines where the string appears. "Looking for help in VBA" if the given string is found in any excel cell then delete everything between two newlines where the string appears.
in VBA if the given string is found then delete everything between two newlines where the string appears. "Looking for help in VBA" if the given string is found in any paragraph/line excel cell then delete everything between two newlines where the string appears. in VBA if the given string is found then delete everything between two newlines where the string appears. "Looking for help in VBA"searched*string if the given string is found in any excel cell then delete everything between two newlines where the string appears. in VBA if the given string is found then delete everything between two newlines where the string appears. "Looking for help in VBA" if the given string is found in any excel cell then delete everything between two newlines where the string appears.
in VBA if the given string is found then delete everything between two newlines where the string appears. "Looking for help in #VBA" if the given string is found in any excel cell then delete paragraph/line everything between two newlines where the string appears. in VBA if the given string is found then delete paragraph/line everything between two newlines where the string appears. "Looking for help in VBA" if the given string is found in any excel cell then delete everything between two newlines where the string appears. searched*string in VBA if the given string is found then delete everything between two newlines where the string appears. "Looking for help in VBA" if the given string is found in any excel cell then delete everything between two newlines where the string appears.
… How can I delete sentences with a specific keyword in excel cells in all sheets?
…..but without the example it was much more difficult to understand and may have been interpreted to mean something else..
Putting the explanation of what is wanted a bit clearer, …
There is text in some cells. The text is split into paragraphs or lines, that is to say we see multi-line text, something like
What we want to do is: Modify the text in cells in this way: If certain words are found in a paragraph or line, then all the text in that line needs to be deleted. Lets say in that example, Bro was one of the words to search for. In that case, the text should be modified so as to look like thisCode:How are you? Well I am OK Bro today Enjoying a wank just now.
We remove all the text, Well I am OK Bro today, but it looks like the lines stay there.Code:How are you? Enjoying a wank just now.
We are manipulating text and some form of line separation is involved, so its usually a good idea to look carefully at the actual characters: Almost immediately I think of Splitting and Joining text where the thing to split by or use to join together will be a text line separator, which can vary. Hence important to take a look, so I will, here, later
https://excelfox.com/forum/showthrea...ll=1#post16727




Reply With Quote
Bookmarks