我想知道如何能够使用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
答案 0 :(得分:2)
我认为您可能正在寻找的是字符串的直接文本替换。以下将对当前活动的单元格执行此操作:
ActiveCell.Replace What:="\r\n", Replacement:=vbLf, LookAt:=xlPart, MatchCase:=False