vba 如何从 Excel 中删除包含少于 3 个字符的单元格?我在工作表中只有一列
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27398688/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I delete a cell from Excel which contains less than 3 characters? I have only one column in sheet
提问by Mohan Nalgire
The Excel file contains only cities. I want to delete the cells which contain less than three characters.
Excel 文件仅包含城市。我想删除包含少于三个字符的单元格。
How do I delete all the cells from Excel which contain less than 3 chars?
如何从 Excel 中删除包含少于 3 个字符的所有单元格?
回答by NickGames
When you are in excel press Ctrl+F
Click the "Replace" tab.
In the box "Find what:" enter ??. (the ammount of characters that are in the cells you're searching for)
The box "Replace with:", leave it empty.
Make sure you check the box "Match entire cell contents".
Then simply click the replace all button
当你在 excel 按Ctrl+F
单击“替换”选项卡。
在“查找内容:”框中输入 ??。(您正在搜索的单元格中的字符数量)
“替换为:”框,将其留空。
确保选中“匹配整个单元格内容”框。
然后只需单击全部替换按钮
The question mark stands for any character, so if you put in four question marks you will get only the cells with four characters. When you put in three question marks you will only get the cells with three characters and so on.
问号代表任何字符,所以如果你输入四个问号,你只会得到四个字符的单元格。当你输入三个问号时,你只会得到三个字符的单元格,依此类推。
Since you only want to delete the cells with less then 3 characters you need to do this twice. On time with "??" (for cells with 2 characters) in the "Find What" box, and one time with "?" (for cells with 1 character) in the "Find What" box. I hope this is what you're looking for.
由于您只想删除少于 3 个字符的单元格,因此您需要执行此操作两次。准时与“??” (对于具有 2 个字符的单元格)在“查找内容”框中,一次使用“?” (对于具有 1 个字符的单元格)在“查找内容”框中。我希望这就是你要找的。