Excel VBA将HTML换行符(\ r \ n)转换为Excel中的换行符
我想知道如何能够使用VBA并将HTML换行符(如\ r \ n)转换为Excel单元格中的换行符。 例如,我从HTML页面复制下列string:
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
我想你可能要找的是一个直接的文本replace的string。 以下将为当前活动的单元格执行此操作:
ActiveCell.Replace What:="\r\n", Replacement:=vbLf, LookAt:=xlPart, MatchCase:=False