excel - 如何通过VBA检测Excel中的换行符
问题描述
我试图通过迭代它们并针对每个单元格中的文本运行 InStr 函数来在各个单元格中找到回车符\换行符。以下查询在大多数单元格中正确找到换行符,但在其中一个单元格中失败。
这些单元格中的换行符对所有单元格都添加了相同的内容,即按 Alt+Enter。
以下是我正在使用的功能:
InStr(startlocation, text, vbLf)
我也尝试了以下所有方法,但无济于事:
InStr(startlocation, text, Chr(10)) 'this seems to be identical in results to using vbLf
InStr(startlocation, text, Chr(13)) 'No results with this
InStr(startlocation, text, ALT + 10) 'I see this returning some results sometimes, not exactly sure for which character though
InStr(startlocation, text, vbCrLf) 'No results with this
有没有其他方法来表示换行符,所以我将它添加到我的查询中?
解决方案
推荐阅读
- html - 带有norwap的表格单元格内的滚动条不起作用
- python - 在 Quora Insincere questions 分类中使用 countvectorizer 文本提取方法后的 CSR 矩阵到密集矩阵
- python - 从数到无穷大的 if 语句
- django - 如何在用户搜索餐点时创建搜索食材的搜索功能?
- javascript - 如何为 ToDo App 添加 JavaScript 自定义弹出框?(+视频解说)
- java - 如何创建具有不同实例的对象数组?
- termux - 我如何解决 msfvenom no options 错误?
- swift - 如何解决:“无法将 'SelfieListViewController' 类型的值分配给类型 '(UIImagePickerControllerDelegate & UINavigationControllerDelegate)?'”
- java - 由于属性文件位置类型,应用程序或集成测试 Spring 上下文创建失败
- .net - 当窗体没有焦点时激活 ContextMenuStrip