1

我想知道如何使用 VBA 并将 HTML 换行符(如 \r \n)转换为 Excel 单元格中的换行符。例如,我从 HTML 页面复制了以下文本字符串:

hello my name is pete \r\n\r\n here are a list of things I would like to do today: \r\n\r\n *wake up \r\n\r\n *eat breakfast

我希望它像这样显示在 Excel 中:

hello my name is pete

here are a list of things I would like to do today:

- wake up
- eat breakfast
4

1 回答 1

2

我认为您可能正在寻找的是字符串的直接文本替换。以下将对当前活动的单元格执行此操作:

ActiveCell.Replace What:="\r\n", Replacement:=vbLf, LookAt:=xlPart, MatchCase:=False
于 2012-12-15T00:14:29.313 回答