Replace HTML tag(
) with Alt+Enter in Excel

2019-09-21 22:34发布

I am working on VBA, but I have one problem of how to replace a tag of HTML with Alt+Enter. For example, If I type a sentence: Hello World. In shell of Excel, I press on Alt+Enter to Enter between Hello and World. Then I want to copy it to somewhere else that after I copied it shows like: HelloWorld. Any help would be appreciate.

2条回答
该账号已被封号
2楼-- · 2019-09-21 23:01

You can use Excel formula:

=SUBSTITUTE(B4, "<br>", " Alt+Enter ")

查看更多
成全新的幸福
3楼-- · 2019-09-21 23:09

The <br> tag in HTML just gives you a line break.

In VBA, you can accomplish the same thing using the vbNewLine constant.

The Replace function will come in handy for this.

Dim input As String
input = "Hello<br>World!"

Dim result As String
result = Replace$(input, "<br>", vbNewLine)
查看更多
登录 后发表回答