如何将Excel中的常规文本replace为HTML无序列表(用于导出为CSV)?

如何将Excel工作表中的特定列转换为HTML无序列表? 让它从这里走:

Item 1 Item 2 Item 3 

至:

 <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul> 

我search了网页,找不到任何东西,甚至远离解决scheme。

假设数据在ColumnA中,在另一列中:

 ="<li>"&A1&"</li>" 

向下复制以适应,在顶部添加<ul> ,在底部添加<ul> </ul> ,select另一列复制,顶部粘贴特殊值,删除ColumnA。

这可能不行,写在记事本中。如果你添加到一个新的模块,你可以像使用公式一样使用它,指定你想要转换成列表的范围。

例如: =getUnorderedList(A1:A10) – 你将无法使用A:Atypes引用来使用当前写入的整个列。

 Public Function getUnorderedList(ByRef Target As Range) As String Dim Result As String: Result = "" Dim Cell As Variant For Each Cell in Target.Cells Result = Result & "<li>" & Cell.Value & "</li>" & vbNewLine Next Cell getUnorderedList = "<ul>" & vbNewLine & Result & "</ul>" End Function