简体   繁体   English

Excel字符串转换为HTML代码/在字符串中间插入文本

[英]Excel string to HTML code / inserting text mid string

How do I insert text (a URL link) from another cell (B1) into this cell (C1) containing HTML code like this: 如何将另一个单元格(B1)中的文本(URL链接)插入到包含如下HTML代码的该单元格(C1)中:

<h4>Features</h4><ul><li><a href="" target="blank">Available in other fabrics</a></li></ul> <h4>功能</ h4> <ul> <li> <a href="" target="blank">在其他结构中可用</a> </ li> </ ul>

Note: - The insert text should fill in the tag. 注意:-插入文本应填写在标签中。 - I tried using concat strings and convert the " into &CHAR(32) but it's not working. - I have a few thousand rows of this data to work thru. Each URL link is different depending on the productSKU. So this process has to be automated. - I am not familar with VB. -我尝试使用concat字符串并将“转换为&CHAR(32),但它不起作用。-我有数千行此类数据可以通过。每个URL链接因productSKU而不同。因此,此过程必须自动化-我对VB不熟悉。

Thanks for your help. 谢谢你的帮助。

So it should be something like 所以应该像

=SUBSTITUTE(C1,CHAR(34)&CHAR(34),CHAR(34)&B1&CHAR(34))

assuming the "" only occurs in the href tag. 假设“”仅出现在href标记中。

It's easier than the alternative which would be 它比替代方案更容易

=SUBSTITUTE(C1,"""""",""""&B1&"""")

(you have to type a pair of double quotes for each double quote you want) (您需要为每个双引号键入一对双引号)

You might consider defining a name (say q) as =char(34) then it would be 您可能会考虑将名称(例如q)定义为= char(34),那么它将是

=SUBSTITUTE(C1,q&q,q&B1&q)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM